Advertisement
Guest User

LadrilloMan

a guest
Nov 9th, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #ETF = ETF_LU1834988278
  2. #Cobas Internacional
  3.  
  4. rm(list = ls(all = TRUE)) #Clear workspace
  5. gc() #Clear memory
  6. library("gmnl") #paquete para estimar el MNL
  7. library("Hmisc") # Library of p-values in correlation matrix
  8. library("PerformanceAnalytics")
  9. #install.packages("FactoMineR")
  10. library("FactoMineR")
  11. #install.packages("openxlsx")
  12. library("openxlsx")
  13. library(data.table)
  14. library(datasets)
  15. library("DAAG")
  16. library("dplyr")
  17. library("lubridate")
  18. library("tidyverse")
  19. library("ggplot2")
  20.  
  21. setwd('C:\\Users\\USUARIO\\OneDrive\\Documentos\\R\\CorrelationCobas\\Datos')
  22.  
  23. set.seed(100)
  24.  
  25. #Creo tabla.
  26. #Utilizo vectores 1:n para posteriormente ordenar.
  27.  
  28. Cobas <- read.xlsx("CobasInt.xlsx")
  29. CobasOrdenado <- cbind(Cobas, c(1:1695))
  30. colnames(CobasOrdenado) <- c("Fecha", "VL_Cobas", "OrdenCobas")
  31. ETF <- read.xlsx("ETF.xlsx")
  32. ETFOrdenado <- cbind(ETF, c(1:3025))
  33. colnames(ETFOrdenado) <- c("Fecha", "VL_ETF", "OrdenETF")
  34.  
  35. Datos <- merge(x=CobasOrdenado, y=ETFOrdenado, by="Fecha")
  36. Datos <- Datos
  37.  
  38. #Quitamos lo que no vale para nada.
  39. DF <- Datos[-c(3, 5)]
  40.  
  41. #Empieza lo divertido
  42.  
  43. ggplot(data=DF, aes(x=VL_ETF, y=VL_Cobas)) + geom_point() + stat_smooth()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement