Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Am adaugat pentru aceeasi perioada datele pentru volume preluate de pe Yahoo Finance in fisierul pe care voi lucra mai departe.
- # Import datele din fisierul txt (Tab delimited)
- tema <- read.table("DateActiuni.txt", header = TRUE, sep = "\t")
- # Salvez datele intr-un dataframe
- df_tema <- data.frame(tema$Data,
- tema$Pret_SP500, tema$Volum_SP500,
- tema$Pret_MCD, tema$Volum_MCD,
- tema$Pret_AAPL, tema$Volum_AAPL,
- tema$Pret_TSLA, tema$Volum_TSLA)
- # Vizualizez dataframe-ul pentru a ma asigura ca a fost efectuat corect importul
- View(df_tema)
- # A - Generez graficele pentru cele 3 actiuni
- # 1. Separat
- plot(df_tema$tema.Pret_SP500, col = "blue", type = "l", main = "Evolutia pretului indicelui de piata S&P 500")
- plot(df_tema$tema.Pret_MCD, col = "yellow", type = "l", main = "Evolutia pretului actiunii MCD")
- plot(df_tema$tema.Pret_AAPL, col = "green", type = "l", main = "Evolutia pretului actiunii AAPL")
- plot(df_tema$tema.Pret_TSLA, col = "red", type = "l", main = "Evolutia pretului actiunii TSLA")
- # 2. In aceeasi fereastra unele sub celelalte
- windows()
- par(mfrow = c(4, 1))
- plot(df_tema$tema.Pret_SP500, col = "blue", type = "l", main = "Evolutia pretului indicelui de piata S&P 500")
- plot(df_tema$tema.Pret_MCD, col = "yellow", type = "l", main = "Evolutia pretului actiunii MCD")
- plot(df_tema$tema.Pret_AAPL, col = "green", type = "l", main = "Evolutia pretului actiunii AAPL")
- plot(df_tema$tema.Pret_TSLA, col = "red", type = "l", main = "Evolutia pretului actiunii TSLA")
- # B - Coeficientele de asimestrie si aplatizare + histograme
- library(moments)
- # aplatizare
- kurtosis(df_tema$tema.Volum_SP500)
- kurtosis(df_tema$tema.Volum_MCD)
- kurtosis(df_tema$tema.Volum_AAPL)
- kurtosis(df_tema$tema.Volum_TSLA)
- # asimetrie
- skewness(df_tema$tema.Volum_SP500)
- skewness(df_tema$tema.Volum_MCD)
- skewness(df_tema$tema.Volum_AAPL)
- skewness(df_tema$tema.Volum_TSLA)
- # histograme
- hist(df_tema$tema.Volum_SP500, col = "blue", main = "Histograma volumului indicelui de piata S&P 500")
- hist(df_tema$tema.Volum_MCD, col = "yellow", main = "Histograma volumului actiunii MCD")
- hist(df_tema$tema.Volum_AAPL, col = "green", main = "Histograma volumului actiunii AAPL")
- hist(df_tema$tema.Volum_TSLA, col = "red", main = "Histograma volumului actiunii TSLA")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement