Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. # Am adaugat pentru aceeasi perioada datele pentru volume preluate de pe Yahoo Finance in fisierul pe care voi lucra mai departe.
  2. # Import datele din fisierul txt (Tab delimited)
  3. tema <- read.table("DateActiuni.txt", header = TRUE, sep = "\t")
  4. # Salvez datele intr-un dataframe
  5. df_tema <- data.frame(tema$Data,
  6. tema$Pret_SP500, tema$Volum_SP500,
  7. tema$Pret_MCD, tema$Volum_MCD,
  8. tema$Pret_AAPL, tema$Volum_AAPL,
  9. tema$Pret_TSLA, tema$Volum_TSLA)
  10. # Vizualizez dataframe-ul pentru a ma asigura ca a fost efectuat corect importul
  11. View(df_tema)
  12.  
  13. # A - Generez graficele pentru cele 3 actiuni
  14. # 1. Separat
  15. plot(df_tema$tema.Pret_SP500, col = "blue", type = "l", main = "Evolutia pretului indicelui de piata S&P 500")
  16. plot(df_tema$tema.Pret_MCD, col = "yellow", type = "l", main = "Evolutia pretului actiunii MCD")
  17. plot(df_tema$tema.Pret_AAPL, col = "green", type = "l", main = "Evolutia pretului actiunii AAPL")
  18. plot(df_tema$tema.Pret_TSLA, col = "red", type = "l", main = "Evolutia pretului actiunii TSLA")
  19.  
  20. # 2. In aceeasi fereastra unele sub celelalte
  21. windows()
  22. par(mfrow = c(4, 1))
  23. plot(df_tema$tema.Pret_SP500, col = "blue", type = "l", main = "Evolutia pretului indicelui de piata S&P 500")
  24. plot(df_tema$tema.Pret_MCD, col = "yellow", type = "l", main = "Evolutia pretului actiunii MCD")
  25. plot(df_tema$tema.Pret_AAPL, col = "green", type = "l", main = "Evolutia pretului actiunii AAPL")
  26. plot(df_tema$tema.Pret_TSLA, col = "red", type = "l", main = "Evolutia pretului actiunii TSLA")
  27.  
  28. # B - Coeficientele de asimestrie si aplatizare + histograme
  29. library(moments)
  30. # aplatizare
  31. kurtosis(df_tema$tema.Volum_SP500)
  32. kurtosis(df_tema$tema.Volum_MCD)
  33. kurtosis(df_tema$tema.Volum_AAPL)
  34. kurtosis(df_tema$tema.Volum_TSLA)
  35. # asimetrie
  36. skewness(df_tema$tema.Volum_SP500)
  37. skewness(df_tema$tema.Volum_MCD)
  38. skewness(df_tema$tema.Volum_AAPL)
  39. skewness(df_tema$tema.Volum_TSLA)
  40.  
  41. # histograme
  42. hist(df_tema$tema.Volum_SP500, col = "blue", main = "Histograma volumului indicelui de piata S&P 500")
  43. hist(df_tema$tema.Volum_MCD, col = "yellow", main = "Histograma volumului actiunii MCD")
  44. hist(df_tema$tema.Volum_AAPL, col = "green", main = "Histograma volumului actiunii AAPL")
  45. hist(df_tema$tema.Volum_TSLA, col = "red", main = "Histograma volumului actiunii TSLA")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement