Se creo la función “tendencia” la cual recibe como parámetros:
“se” este parametro es la serie de tiempo que se usará y debe de ser de clase ts
“medmov” es el orden de la media movil con la que se desee trabajar
Como podemos notar la anterior función lo que nos muestra es la tendencia que tiene la Serie de Tiempo evaluada y esta es calculada en base a la media movil propuesta.
tendencia<-function(se,medmov) {
if(class(se)=="ts"){
s<-as.numeric(se)
mean_number<-ma(se, medmov, centre=TRUE)
periodo<-na.omit(mean_number); mean_number<-as.numeric(mean_number)
if(periodo[1]<periodo[length(periodo)]){tendencia <-"Tendencia creciente"
} else if(periodo[1]>periodo[length(periodo)]){tendencia <- "Tendencia decreciente"
}else{ tendencia<-"Tendencia constante"}
Tiempo<-c(1:length(se))
Tiempo1<-c(1:length(mean_number))
g1<-ggplot()+geom_line(aes(x=Tiempo, y=mean_number), color="red", size=2)+
labs(x="Tiempo", y="Tendencia", title = "Tendencia ocupando Medias Moviles",
subtitle = tendencia)+theme_bw()+theme(plot.title = element_text(hjust = 1))+theme(plot.subtitle = element_text(hjust = 1))+theme_economist()
return(list(g1,mean_number))
}else{
stop('class(se) no es ts')
}
}## [[1]]
##
## [[2]]
## [1] NA NA NA NA NA NA 126.7917
## [8] 127.2500 127.9583 128.5833 129.0000 129.7500 131.2500 133.0833
## [15] 134.9167 136.4167 137.4167 138.7500 140.9167 143.1667 145.7083
## [22] 148.4167 151.5417 154.7083 157.1250 159.5417 161.8333 164.1250
## [29] 166.6667 169.0833 171.2500 173.5833 175.4583 176.8333 178.0417
## [36] 180.1667 183.1250 186.2083 189.0417 191.2917 193.5833 195.8333
## [43] 198.0417 199.7500 202.2083 206.2500 210.4167 213.3750 215.8333
## [50] 218.5000 220.9167 222.9167 224.0833 224.7083 225.3333 225.3333
## [57] 224.9583 224.5833 224.4583 225.5417 228.0000 230.4583 232.2500
## [64] 233.9167 235.6250 237.7500 240.5000 243.9583 247.1667 250.2500
## [71] 253.5000 257.1250 261.8333 266.6667 271.1250 275.2083 278.5000
## [78] 281.9583 285.7500 289.3333 293.2500 297.1667 301.0000 305.4583
## [85] 309.9583 314.4167 318.6250 321.7500 324.5000 327.0833 329.5417
## [92] 331.8333 334.4583 337.5417 340.5417 344.0833 348.2500 353.0000
## [99] 357.6250 361.3750 364.5000 367.1667 369.4583 371.2083 372.1667
## [106] 372.4167 372.7500 373.6250 375.2500 377.9167 379.5000 380.0000
## [113] 380.7083 380.9583 381.8333 383.6667 386.5000 390.3333 394.7083
## [120] 398.6250 402.5417 407.1667 411.8750 416.3333 420.5000 425.5000
## [127] 430.7083 435.1250 437.7083 440.9583 445.8333 450.6250 456.3333
## [134] 461.3750 465.2083 469.3333 472.7500 475.0417 NA NA
## [141] NA NA NA NA
serie1<-c(as.numeric(fecha[123], "%y"), as.numeric(fecha[123], "%m"))
s1<-ts(series[500,-c(1:7)] %>% t() %>% na.omit(),frequency = 12, start=serie1[1] )
tendencia(s1,10)## [[1]]
##
## [[2]]
## [1] NA NA NA NA NA 662.85 768.80 881.25
## [9] 983.30 1084.70 1167.85 1222.35 1278.05 1328.25 1366.65 1398.40
## [17] 1416.35 1398.95 1381.05 1364.25 1348.15 1330.30 1304.15 1271.10
## [25] 1230.65 1199.95 1168.40 1149.40 1114.35 1065.30 1018.15 987.20
## [33] 965.95 942.70 924.90 907.65 886.10 856.75 848.65 841.65
## [41] 815.95 788.15 762.50 748.05 738.90 723.10 715.50 716.60
## [49] 706.35 700.50 709.65 713.20 704.70 683.85 675.25 686.70
## [57] 697.20 702.20 708.45 709.70 704.10 705.20 710.25 720.85
## [65] 719.20 698.75 680.70 678.10 678.80 675.95 682.85 682.65
## [73] 676.95 678.60 691.65 712.65 720.40 711.60 708.35 724.80
## [81] 740.50 756.90 779.80 799.10 808.35 819.05 835.95 862.70
## [89] 882.90 879.40 877.00 892.75 917.20 935.45 953.25 968.30
## [97] 991.80 1017.25 1035.90 1064.80 1094.30 1102.75 1109.95 1137.80
## [105] 1169.30 1198.75 1230.50 1248.35 1280.10 NA NA NA
## [113] NA NA
serie1<-c(as.numeric(fecha[10], "%y"), as.numeric(fecha[10], "%m"))
s2<-ts(series[800,-c(1:7)] %>% t() %>% na.omit(),frequency = 12, start=serie1[1] )
tendencia(s2,10)## [[1]]
##
## [[2]]
## [1] NA NA NA NA NA 82.65 83.05 83.05 83.05 82.80
## [11] 82.55 82.90 85.55 87.30 84.55 82.00 81.80 81.90 81.70 81.35
## [21] 81.30 81.35 81.25 81.65 84.15 85.80 83.30 81.15 81.35 81.85
## [31] 81.90 81.65 81.55 81.65 81.35 81.35 84.05 85.80 83.30 81.30
## [41] 81.55 82.05 82.40 82.50 83.20 84.25 84.80 84.15 84.60 85.55
## [51] 83.25 81.40 82.10 83.35 84.30 84.85 85.40 87.70 91.05 93.60
## [61] 97.45 99.80 97.15 94.65 94.80 95.50 96.05 96.60 97.45 98.05
## [71] 98.45 99.85 103.55 105.55 102.45 99.65 99.45 99.45 98.75 97.90
## [81] 97.55 97.20 96.95 97.55 100.45 101.75 98.40 95.80 95.95 96.30
## [91] 96.00 95.60 95.60 95.90 96.55 98.30 102.10 103.80 100.75 98.60
## [101] 99.10 99.90 100.40 100.75 101.40 102.10 102.80 104.70 109.00 111.10
## [111] 108.15 105.85 106.20 107.05 107.35 107.55 108.45 109.35 109.95 111.90
## [121] 116.40 118.80 116.00 113.65 114.10 114.35 113.35 111.70 110.20 108.40
## [131] 106.50 105.15 106.40 106.00 100.50 96.10 94.35 93.45 92.45 NA
## [141] NA NA NA NA
La función “estac” es la funcion encarcagada de sacar la estacionalidad de la Serie de Tiempo de elección y recibe los siguiente parámetros:
“se” este parametro es la serie de tiempo que se usará y debe de ser de clase ts
“tipo” en este parámetro solo se tienen dos opciones de elección: “multiplicativa” o “aditiva”, en caso contrario a esas dos opciones se envia un mensaje de error. Lo anterior sirve para descomponer a la Serie de Tiempo
“periodo” es la temporalidad con la que cuenta la Serie de Tiempo suministrada
“medmov” es el orden de la media movil con la que se desee trabajar
estac <- function(se, tipo, periodo, medmov){
if(class(se)=="ts"){
if(tipo=="aditiva"){
tend<-tendencia(se,medmov); s<-as.numeric(se)
detrend<-s-tend[[2]]
m<-t(matrix(data = detrend, nrow = 4))
estac<-colMeans(m, na.rm=TRUE)
estac<-rep_len(estac, length.out = length(s))
df<-data.frame(Tiempo=c(1:length(s)), Serie=s, Tendencia=tend[[2]], Estacionalidad=estac)
g1<-ggplot(df)+geom_line(aes(x=Tiempo, y=Estacionalidad), color="blue", size=1)+
geom_point(aes(x=Tiempo, y=Estacionalidad), color="burlywood3")+
labs(x="Tiempo", y="Estacionalidad", title = "Estacionalidad", subtitle = "Metodo Aditivo")+theme_bw()+
theme(plot.title = element_text(hjust = 1))+theme_economist()
return(list(g1, df$Estacionalidad))
}else if(tipo=="multiplicativa"){
tend<-tendencia(se,medmov); s<-as.numeric(se)
detrend<-s/tend[[2]]
m<-t(matrix(data = detrend, nrow = 4))
estac<-colMeans(m, na.rm=TRUE)
estac<-rep_len(estac, length.out = length(s))
df<-data.frame(Tiempo=c(1:length(s)), Serie=s, Tendencia=tend[[2]], Estacionalidad=estac)
g1<-ggplot(df)+geom_line(aes(x=Tiempo, y=Estacionalidad), color="burlywood3", size=1.1)+
geom_point(aes(x=Tiempo, y=Estacionalidad), color="blue")+
labs(x="Tiempo", y="Estacionalidad", title = "Estacionalidad", subtitle = "Metodo Multiplicativo")+theme_bw()+
theme(plot.title = element_text(hjust = 0.5))+theme_economist()
return(list(g1, df$Estacionalidad))
}else {stop('El parametro es incorrecto')}
}else{stop('class(se) no es ts')}
}## [[1]]
##
## [[2]]
## [1] 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917
## [8] 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634
## [15] 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466
## [22] 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580
## [29] 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917
## [36] 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634
## [43] 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466
## [50] 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580
## [57] 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917
## [64] 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634
## [71] 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466
## [78] 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580
## [85] 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917
## [92] 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634
## [99] 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466
## [106] 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580
## [113] 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917
## [120] 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634
## [127] 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580 0.9813466
## [134] 0.9706634 1.0134917 1.0330580 0.9813466 0.9706634 1.0134917 1.0330580
## [141] 0.9813466 0.9706634 1.0134917 1.0330580
serie1<-c(as.numeric(fecha[123], "%y"), as.numeric(fecha[123], "%m"))
s1<-ts(series[500,-c(1:7)] %>% t() %>% na.omit(),frequency = 12, start=serie1[1] )
estac(s1,"aditiva",10,10)## [[1]]
##
## [[2]]
## [1] 24.08077 -1.70000 -29.65769 25.60192 24.08077 -1.70000 -29.65769
## [8] 25.60192 24.08077 -1.70000 -29.65769 25.60192 24.08077 -1.70000
## [15] -29.65769 25.60192 24.08077 -1.70000 -29.65769 25.60192 24.08077
## [22] -1.70000 -29.65769 25.60192 24.08077 -1.70000 -29.65769 25.60192
## [29] 24.08077 -1.70000 -29.65769 25.60192 24.08077 -1.70000 -29.65769
## [36] 25.60192 24.08077 -1.70000 -29.65769 25.60192 24.08077 -1.70000
## [43] -29.65769 25.60192 24.08077 -1.70000 -29.65769 25.60192 24.08077
## [50] -1.70000 -29.65769 25.60192 24.08077 -1.70000 -29.65769 25.60192
## [57] 24.08077 -1.70000 -29.65769 25.60192 24.08077 -1.70000 -29.65769
## [64] 25.60192 24.08077 -1.70000 -29.65769 25.60192 24.08077 -1.70000
## [71] -29.65769 25.60192 24.08077 -1.70000 -29.65769 25.60192 24.08077
## [78] -1.70000 -29.65769 25.60192 24.08077 -1.70000 -29.65769 25.60192
## [85] 24.08077 -1.70000 -29.65769 25.60192 24.08077 -1.70000 -29.65769
## [92] 25.60192 24.08077 -1.70000 -29.65769 25.60192 24.08077 -1.70000
## [99] -29.65769 25.60192 24.08077 -1.70000 -29.65769 25.60192 24.08077
## [106] -1.70000 -29.65769 25.60192 24.08077 -1.70000 -29.65769 25.60192
## [113] 24.08077 -1.70000
serie1<-c(as.numeric(fecha[10], "%y"), as.numeric(fecha[10], "%m"))
s2<-ts(series[800,-c(1:7)] %>% t() %>% na.omit(),frequency = 12, start=serie1[1] )
estac(s2,"multiplicativa",10,10)## [[1]]
##
## [[2]]
## [1] 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517
## [8] 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329
## [15] 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177
## [22] 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213
## [29] 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517
## [36] 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329
## [43] 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177
## [50] 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213
## [57] 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517
## [64] 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329
## [71] 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177
## [78] 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213
## [85] 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517
## [92] 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329
## [99] 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177
## [106] 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213
## [113] 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517
## [120] 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329
## [127] 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213 1.0369177
## [134] 1.0551329 1.0114517 0.8901213 1.0369177 1.0551329 1.0114517 0.8901213
## [141] 1.0369177 1.0551329 1.0114517 0.8901213
La función “aleatorio” es la encargada de regresarnos el componente o error aleatorio de la Serie de tiempo proporcionada por el usuario y recibe los siguientes parámetros.
“se” este parametro es la serie de tiempo que se usará y debe de ser de clase ts
“tipo” en este parámetro solo se tienen dos opciones de elección: “multiplicativa” o “aditiva”, en caso contrario a esas dos opciones se envia un mensaje de error. Lo anterior sirve para descomponer a la Serie de Tiempo
“periodo” es la temporalidad con la que cuenta la Serie de Tiempo suministrada
“medmov” es el orden de la media movil con la que se desee trabajar
aleatorio<-function(se, tipo, periodo, medmov){
if(class(se)=="ts"){
if(tipo=="aditiva"){
tend<-tendencia(se,medmov)
est <- estac(se, tipo, periodo, medmov)
s<-as.numeric(se)
error<-s-tend[[2]]-est[[2]]
df<-data.frame(Tiempo=c(1:length(s)), Error=error)
g1<-ggplot(df)+geom_line(aes(x=Tiempo, y=Error), color="dodgerblue4", size=1.1)+
geom_point(aes(x=Tiempo, y=Error), color="firebrick4")+
labs(x="Tiempo", y="Error Aleatorio", title = "Error Aleatorio", subtitle = "Metodo Aditivo")+theme_bw()+
theme(plot.title = element_text(hjust = 0.5))+theme_economist()
return(list(g1,error))
}else if(tipo=="multiplicativa"){
tend<-tendencia(se,medmov)
est <- estac(se, tipo, periodo, medmov)
s<-as.numeric(se)
error<-s/(tend[[2]]*est[[2]])
df<-data.frame(Tiempo=c(1:length(s)), Error=as.numeric(error))
g1<-ggplot(df)+geom_line(aes(x=Tiempo, y=Error), color="firebrick4", size=1)+
geom_point(aes(x=Tiempo, y=Error), color="dodgerblue4")+
labs(x="Tiempo", y="Error Aleatorio", title = "Error Aleatorio", subtitle = "Metodo Multiplicativo")+theme_bw()+
theme(plot.title = element_text(hjust = 0.5))+theme_economist()
return(list(g1,error))
}else(stop('El parametro es incorrecto'))
}else{stop('class(se) no es ts')}
}## [[1]]
##
## [[2]]
## [1] NA NA NA NA 0.9349760 1.0422868 1.1083856
## [8] 1.1078896 1.0805854 0.9629578 0.8123942 0.9133352 0.9483938 1.0405462
## [15] 1.0640382 0.9460994 0.8841718 1.0429097 1.1493752 1.1383310 1.1018187
## [22] 0.9293409 0.7600163 0.9152890 0.9949909 1.0154151 1.0955505 0.9319098
## [29] 0.9990416 1.0266186 1.1069817 1.0972273 1.0672214 0.9496226 0.8208344
## [36] 0.9234941 1.0083203 1.0521429 1.0293555 0.8985024 0.9225898 1.0945534
## [43] 1.1093832 1.1479618 1.0354186 0.9592816 0.8314039 0.9202669 0.9748654
## [50] 0.9644120 1.0663232 0.9933623 0.9869535 1.0433728 1.0973590 1.1361206
## [57] 1.0589417 0.9745121 0.8153977 0.9126612 0.9890104 0.9079729 1.0339873
## [64] 0.9247173 0.9661093 1.0758129 1.1760424 1.1277294 1.0467945 0.9410965
## [71] 0.8123605 0.9126998 1.0187448 0.9674238 0.9995567 0.9266617 0.9398195
## [78] 1.0828624 1.1956867 1.1231630 1.0580049 0.9440842 0.7962376 0.9323653
## [85] 1.0087957 0.9723061 1.0065328 0.9190034 0.9473255 1.1062006 1.1735121
## [92] 1.1398580 1.0536984 0.9311378 0.8092072 0.9161661 1.0038702 0.9483095
## [99] 1.0141058 0.9139941 0.9415919 1.1073014 1.1695010 1.1639676 1.0646303
## [106] 0.9426170 0.8215384 0.9228528 1.0117546 0.9485661 0.9853269 0.8756820
## [113] 0.9264869 1.1043207 1.1958377 1.2184824 1.0283946 0.9379620 0.7982339
## [120] 0.8791401 1.0043610 0.9438108 1.0135238 0.9040753 0.9632485 1.0691557
## [127] 1.1854315 1.1920405 1.0384937 0.9337250 0.8193399 0.9295552 1.0209973
## [134] 0.9483633 0.9207622 0.9339394 0.9695789 1.0889987 1.2064772 1.1614560
## [141] NA NA NA NA
serie1<-c(as.numeric(fecha[123], "%y"), as.numeric(fecha[123], "%m"))
s1<-ts(series[500,-c(1:7)] %>% t() %>% na.omit(),frequency = 12, start=serie1[1] )
aleatorio(s1,"aditiva",10,10)## [[1]]
##
## [[2]]
## [1] NA NA NA NA NA
## [6] 149.8500000 190.8576923 -46.8519231 80.6192308 -139.0000000
## [11] -89.1923077 27.0480769 168.8692308 -3.5500000 315.0076923
## [16] -62.0019231 28.5692308 37.7500000 165.6076923 -106.8519231
## [21] -27.2307692 9.4000000 -214.4923077 79.2980769 8.2692308
## [26] 230.7500000 -93.7423077 160.9980769 -183.4307692 -27.6000000
## [31] -10.4923077 61.1980769 -46.0307692 -150.0000000 -28.2423077
## [36] -51.2519231 62.8192308 127.9500000 24.0076923 -75.2519231
## [41] 36.9692308 -42.4500000 -45.8423077 112.3480769 -130.9807692
## [46] -118.4000000 10.1576923 4.7980769 59.5692308 -36.8000000
## [51] 11.0076923 39.1980769 -53.7807692 10.8500000 62.4076923
## [56] -2.3019231 -61.2807692 -87.5000000 -171.7923077 37.6980769
## [61] 80.8192308 166.5000000 2.4076923 63.5480769 -127.2807692
## [66] -7.0500000 50.9576923 -31.7019231 -42.8807692 -87.2500000
## [71] -67.1923077 23.7480769 67.9692308 61.1000000 -30.9923077
## [76] 74.7480769 -169.4807692 -24.9000000 1.3076923 77.5980769
## [81] 0.4192308 -47.2000000 -133.1423077 0.2980769 40.5692308
## [86] 67.6500000 24.7076923 -1.3019231 -42.9807692 -48.7000000
## [91] 130.6576923 -85.3519231 85.7192308 -114.7500000 -114.5923077
## [96] -92.9019231 114.1192308 61.4500000 32.7576923 -80.4019231
## [101] -20.3807692 81.9500000 105.7076923 -130.4019231 -20.3807692
## [106] -70.0500000 -127.8423077 4.0480769 90.8192308 NA
## [111] NA NA NA NA
serie1<-c(as.numeric(fecha[10], "%y"), as.numeric(fecha[10], "%m"))
s2<-ts(series[800,-c(1:7)] %>% t() %>% na.omit(),frequency = 12, start=serie1[1] )
aleatorio(s2,"multiplicativa",10,10)## [[1]]
##
## [[2]]
## [1] NA NA NA NA NA 1.0090964 0.9404643
## [8] 0.5816740 1.0102650 1.0416070 1.1018580 1.1519011 0.9807424 0.9553473
## [15] 1.0056334 1.1919450 1.0257030 1.0183372 0.9318018 0.6352594 1.0201490
## [22] 1.0135719 1.0586460 1.1557766 0.9512171 0.9830952 1.0207240 1.2044299
## [29] 1.0195220 1.0073802 0.9415981 0.6191660 1.0170216 1.0330627 1.0694980
## [36] 1.1738488 0.9752970 0.9499571 1.0563306 1.0778414 1.0288474 1.0395773
## [43] 0.9118875 0.6672567 1.0200349 1.0124310 1.0493045 1.1748417 1.0145544
## [50] 1.0192029 1.1163451 1.2973413 0.6930500 0.8528026 0.9499753 0.6752571
## [57] 1.0389285 1.0806704 1.1075800 1.1762538 0.9797360 0.9496472 1.0075051
## [64] 1.2106828 1.0681609 1.0321025 0.8852296 0.6163814 0.9797360 1.0052604
## [71] 1.0745408 1.1588840 0.9965277 0.9966842 1.0422374 1.2288532 1.0570059
## [78] 0.9911090 0.8810498 0.6081966 1.0083902 1.0140513 1.0809682 1.1286248
## [85] 0.9984794 0.9873345 1.0549918 1.2078765 1.0151544 0.9644787 0.8547945
## [92] 0.6580834 1.0289588 1.0376802 1.0649665 1.1428712 0.9728977 0.9587046
## [99] 1.0303840 1.2191515 1.0607390 1.0056184 0.8468756 0.6690476 1.0081464
## [106] 1.0025150 1.0675414 1.1481216 0.9732443 0.9810172 1.0512988 1.2099427
## [113] 1.0533899 1.0269852 0.8473067 0.6580834 0.9781801 0.9967171 1.0700562
## [120] 1.1244464 1.0107937 0.9972095 1.0483396 1.1960979 1.0649779 0.9862878
## [127] 0.8896794 0.6738643 1.0501597 1.0491675 1.1047200 1.1538923 0.9698350
## [134] 0.9566890 1.0231096 1.2041058 0.9301547 1.0446018 0.8127585 NA
## [141] NA NA NA NA
La funcion “separa” descompondrá la Serie de Tiempo seleccionada en tres componentes: tendecia, estacionalidad y el componente aleatorio. Nos proporciona una grafica con todos elementos por separado, así como una respectiva tabla con sus valores asociados. Por lo cual recibe los siguiente parámetros:
“se” este parametro es la serie de tiempo que se usará y debe de ser de clase ts
“tipo” en este parámetro solo se tienen dos opciones de elección: “multiplicativa” o “aditiva”, en caso contrario a esas dos opciones se envia un mensaje de error. Lo anterior sirve para descomponer a la Serie de Tiempo
“periodo” es la temporalidad con la que cuenta la Serie de Tiempo suministrada
“medmov” es el orden de la media movil con la que se desee trabajar
separa <- function(se, tipo, periodo, medmov){
if(class(se)=="ts"){
if(tipo=="aditiva" | tipo=="multiplicativa"){
tend<-tendencia(se,medmov)
est<-estac(se, tipo, periodo, medmov)
error <- aleatorio(se, tipo, periodo, medmov)
df<-data.frame(Tiempo=c(1:length(se)), Serie=as.numeric(se), Tendencia=tend[[2]], Estacionalidad=est[[2]], Comp_Aleatorio=error[[2]])
g1<-ggplot(df)+geom_line(aes(x=Tiempo, y=Serie), color="yellow", size=1.2)+
geom_point(aes(x=Tiempo, y=Serie), color="forestgreen")+labs(x="Tiempo", y="Serie", title = "Serie de Tiempo")+
theme_bw()+theme(plot.title = element_text(hjust = 0.5))+theme_economist()
plots<-grid.arrange(g1, tend[[1]], est[[1]], error[[1]], ncol=2)
return(list(df, plots))
} else{stop('El parametro es incorrecto')}
}else{stop('class(se) no es ts')}
}## [[1]]
## Tiempo Serie Tendencia Estacionalidad Comp_Aleatorio
## 1 1 112 NA 0.9822973 NA
## 2 2 118 NA 0.9710033 NA
## 3 3 132 NA 1.0099150 NA
## 4 4 129 NA 1.0297271 NA
## 5 5 121 NA 0.9822973 NA
## 6 6 135 NA 0.9710033 NA
## 7 7 148 126.7917 1.0099150 1.1558093
## 8 8 148 127.2500 1.0297271 1.1294884
## 9 9 136 127.9583 0.9822973 1.0820003
## 10 10 119 128.5833 0.9710033 0.9531069
## 11 11 104 129.0000 1.0099150 0.7982866
## 12 12 118 129.7500 1.0297271 0.8831866
## 13 13 115 131.2500 0.9822973 0.8919810
## 14 14 126 133.0833 0.9710033 0.9750484
## 15 15 141 134.9167 1.0099150 1.0348292
## 16 16 135 136.4167 1.0297271 0.9610460
## 17 17 125 137.4167 0.9822973 0.9260356
## 18 18 149 138.7500 0.9710033 1.1059426
## 19 19 170 140.9167 1.0099150 1.1945429
## 20 20 170 143.1667 1.0297271 1.1531475
## 21 21 158 145.7083 0.9822973 1.1039001
## 22 22 133 148.4167 0.9710033 0.9228865
## 23 23 114 151.5417 1.0099150 0.7448828
## 24 24 140 154.7083 1.0297271 0.8788043
## 25 25 145 157.1250 0.9822973 0.9394632
## 26 26 150 159.5417 0.9710033 0.9682699
## 27 27 178 161.8333 1.0099150 1.0890986
## 28 28 163 164.1250 1.0297271 0.9644744
## 29 29 172 166.6667 0.9822973 1.0505985
## 30 30 178 169.0833 0.9710033 1.0841728
## 31 31 199 171.2500 1.0099150 1.1506353
## 32 32 199 173.5833 1.0297271 1.1133274
## 33 33 184 175.4583 0.9822973 1.0675811
## 34 34 162 176.8333 0.9710033 0.9434746
## 35 35 146 178.0417 1.0099150 0.8119820
## 36 36 166 180.1667 1.0297271 0.8947702
## 37 37 171 183.1250 0.9822973 0.9506169
## 38 38 180 186.2083 0.9710033 0.9955262
## 39 39 193 189.0417 1.0099150 1.0109157
## 40 40 181 191.2917 1.0297271 0.9188833
## 41 41 183 193.5833 0.9822973 0.9623658
## 42 42 218 195.8333 0.9710033 1.1464344
## 43 43 230 198.0417 1.0099150 1.1499698
## 44 44 242 199.7500 1.0297271 1.1765393
## 45 45 209 202.2083 0.9822973 1.0522145
## 46 46 191 206.2500 0.9710033 0.9537152
## 47 47 172 210.4167 1.0099150 0.8094005
## 48 48 194 213.3750 1.0297271 0.8829499
## 49 49 196 215.8333 0.9822973 0.9244738
## 50 50 196 218.5000 0.9710033 0.9238127
## 51 51 236 220.9167 1.0099150 1.0577882
## 52 52 235 222.9167 1.0297271 1.0237718
## 53 53 229 224.0833 0.9822973 1.0403584
## 54 54 243 224.7083 0.9710033 1.1136954
## 55 55 264 225.3333 1.0099150 1.1600953
## 56 56 272 225.3333 1.0297271 1.1722529
## 57 57 237 224.9583 0.9822973 1.0725149
## 58 58 211 224.5833 0.9710033 0.9675741
## 59 59 180 224.4583 1.0099150 0.7940575
## 60 60 201 225.5417 1.0297271 0.8654602
## 61 61 204 228.0000 0.9822973 0.9108616
## 62 62 188 230.4583 0.9710033 0.8401266
## 63 63 235 232.2500 1.0099150 1.0019068
## 64 64 227 233.9167 1.0297271 0.9424158
## 65 65 234 235.6250 0.9822973 1.0110009
## 66 66 264 237.7500 0.9710033 1.1435699
## 67 67 302 240.5000 1.0099150 1.2433891
## 68 68 293 243.9583 1.0297271 1.1663525
## 69 69 259 247.1667 0.9822973 1.0667605
## 70 70 229 250.2500 0.9710033 0.9424118
## 71 71 203 253.5000 1.0099150 0.7929271
## 72 72 229 257.1250 1.0297271 0.8649062
## 73 73 242 261.8333 0.9822973 0.9409087
## 74 74 233 266.6667 0.9710033 0.8998425
## 75 75 267 271.1250 1.0099150 0.9751173
## 76 76 269 275.2083 1.0297271 0.9492236
## 77 77 270 278.5000 0.9822973 0.9869511
## 78 78 315 281.9583 0.9710033 1.1505485
## 79 79 364 285.7500 1.0099150 1.2613347
## 80 80 347 289.3333 1.0297271 1.1646860
## 81 81 312 293.2500 0.9822973 1.0831127
## 82 82 274 297.1667 0.9710033 0.9495761
## 83 83 237 301.0000 1.0099150 0.7796452
## 84 84 278 305.4583 1.0297271 0.8838339
## 85 85 284 309.9583 0.9822973 0.9327647
## 86 86 277 314.4167 0.9710033 0.9073055
## 87 87 317 318.6250 1.0099150 0.9851324
## 88 88 313 321.7500 1.0297271 0.9447211
## 89 89 318 324.5000 0.9822973 0.9976300
## 90 90 374 327.0833 0.9710033 1.1775856
## 91 91 413 329.5417 1.0099150 1.2409518
## 92 92 405 331.8333 1.0297271 1.1852579
## 93 93 355 334.4583 0.9822973 1.0805463
## 94 94 306 337.5417 0.9710033 0.9336269
## 95 95 271 340.5417 1.0099150 0.7879782
## 96 96 306 344.0833 1.0297271 0.8636457
## 97 97 315 348.2500 0.9822973 0.9208237
## 98 98 301 353.0000 0.9710033 0.8781549
## 99 99 356 357.6250 1.0099150 0.9856831
## 100 100 348 361.3750 1.0297271 0.9351881
## 101 101 355 364.5000 0.9822973 0.9914890
## 102 102 422 367.1667 0.9710033 1.1836642
## 103 103 465 369.4583 1.0099150 1.2462428
## 104 104 467 371.2083 1.0297271 1.2217350
## 105 105 404 372.1667 0.9822973 1.1050984
## 106 106 347 372.4167 0.9710033 0.9595767
## 107 107 305 372.7500 1.0099150 0.8102096
## 108 108 336 373.6250 1.0297271 0.8733357
## 109 109 340 375.2500 0.9822973 0.9223915
## 110 110 318 377.9167 0.9710033 0.8665834
## 111 111 362 379.5000 1.0099150 0.9445218
## 112 112 348 380.0000 1.0297271 0.8893516
## 113 113 363 380.7083 0.9822973 0.9706693
## 114 114 435 380.9583 0.9710033 1.1759561
## 115 115 491 381.8333 1.0099150 1.2732768
## 116 116 505 383.6667 1.0297271 1.2782481
## 117 117 404 386.5000 0.9822973 1.0641159
## 118 118 359 390.3333 0.9710033 0.9471922
## 119 119 310 394.7083 1.0099150 0.7776794
## 120 120 337 398.6250 1.0297271 0.8210001
## 121 121 360 402.5417 0.9822973 0.9104345
## 122 122 342 407.1667 0.9710033 0.8650341
## 123 123 406 411.8750 1.0099150 0.9760584
## 124 124 396 416.3333 1.0297271 0.9237019
## 125 125 420 420.5000 0.9822973 1.0168113
## 126 126 472 425.5000 0.9710033 1.1424094
## 127 127 548 430.7083 1.0099150 1.2598315
## 128 128 559 435.1250 1.0297271 1.2476007
## 129 129 463 437.7083 0.9822973 1.0768451
## 130 130 407 440.9583 0.9710033 0.9505526
## 131 131 362 445.8333 1.0099150 0.8039911
## 132 132 405 450.6250 1.0297271 0.8728057
## 133 133 417 456.3333 0.9822973 0.9302741
## 134 134 391 461.3750 0.9710033 0.8727744
## 135 135 419 465.2083 1.0099150 0.8918293
## 136 136 461 469.3333 1.0297271 0.9538880
## 137 137 472 472.7500 0.9822973 1.0164067
## 138 138 535 475.0417 0.9710033 1.1598488
## 139 139 622 NA 1.0099150 NA
## 140 140 606 NA 1.0297271 NA
## 141 141 508 NA 0.9822973 NA
## 142 142 461 NA 0.9710033 NA
## 143 143 390 NA 1.0099150 NA
## 144 144 432 NA 1.0297271 NA
##
## [[2]]
## TableGrob (2 x 2) "arrange": 4 grobs
## z cells name grob
## 1 1 (1-1,1-1) arrange gtable[layout]
## 2 2 (1-1,2-2) arrange gtable[layout]
## 3 3 (2-2,1-1) arrange gtable[layout]
## 4 4 (2-2,2-2) arrange gtable[layout]
serie1<-c(as.numeric(fecha[123], "%y"), as.numeric(fecha[123], "%m"))
s1<-ts(series[500,-c(1:7)] %>% t() %>% na.omit(),frequency = 12, start=serie1[1] )
separa(s1,"multiplicativa",10,10)## [[1]]
## Tiempo Serie Tendencia Estacionalidad Comp_Aleatorio
## 1 1 54 NA 1.0216519 NA
## 2 2 151 NA 0.9971538 NA
## 3 3 346 NA 0.9631256 NA
## 4 4 407 NA 1.0343934 NA
## 5 5 540 NA 1.0216519 NA
## 6 6 811 662.85 0.9971538 1.2269968
## 7 7 930 768.80 0.9631256 1.2559914
## 8 8 860 881.25 1.0343934 0.9434385
## 9 9 1088 983.30 1.0216519 1.0830286
## 10 10 944 1084.70 0.9971538 0.8727708
## 11 11 1049 1167.85 0.9631256 0.9326217
## 12 12 1275 1222.35 1.0343934 1.0083908
## 13 13 1471 1278.05 1.0216519 1.1265796
## 14 14 1323 1328.25 0.9971538 0.9988905
## 15 15 1652 1366.65 0.9631256 1.2550754
## 16 16 1362 1398.40 1.0343934 0.9415859
## 17 17 1469 1416.35 1.0216519 1.0151922
## 18 18 1435 1398.95 0.9971538 1.0286972
## 19 19 1517 1381.05 0.9631256 1.1404947
## 20 20 1283 1364.25 1.0343934 0.9091739
## 21 21 1345 1348.15 1.0216519 0.9765200
## 22 22 1338 1330.30 0.9971538 1.0086590
## 23 23 1060 1304.15 0.9631256 0.8439086
## 24 24 1376 1271.10 1.0343934 1.0465331
## 25 25 1263 1230.65 1.0216519 1.0045368
## 26 26 1429 1199.95 0.9971538 1.1942821
## 27 27 1045 1168.40 0.9631256 0.9286281
## 28 28 1336 1149.40 1.0343934 1.1236978
## 29 29 955 1114.35 1.0216519 0.8388394
## 30 30 1036 1065.30 0.9971538 0.9752718
## 31 31 978 1018.15 0.9631256 0.9973422
## 32 32 1074 987.20 1.0343934 1.0517521
## 33 33 944 965.95 1.0216519 0.9565648
## 34 34 791 942.70 0.9971538 0.8414742
## 35 35 867 924.90 0.9631256 0.9732881
## 36 36 882 907.65 1.0343934 0.9394300
## 37 37 973 886.10 1.0216519 1.0747988
## 38 38 983 856.75 0.9971538 1.1506341
## 39 39 843 848.65 0.9631256 1.0313737
## 40 40 792 841.65 1.0343934 0.9097203
## 41 41 877 815.95 1.0216519 1.0520421
## 42 42 744 788.15 0.9971538 0.9466772
## 43 43 687 762.50 0.9631256 0.9354789
## 44 44 886 748.05 1.0343934 1.1450313
## 45 45 632 738.90 1.0216519 0.8371986
## 46 46 603 723.10 0.9971538 0.8362898
## 47 47 696 715.50 0.9631256 1.0099891
## 48 48 747 716.60 1.0343934 1.0077622
## 49 49 790 706.35 1.0216519 1.0947229
## 50 50 662 700.50 0.9971538 0.9477367
## 51 51 691 709.65 0.9631256 1.0109995
## 52 52 778 713.20 1.0343934 1.0545872
## 53 53 675 704.70 1.0216519 0.9375546
## 54 54 693 683.85 0.9971538 1.0162726
## 55 55 708 675.25 0.9631256 1.0886437
## 56 56 710 686.70 1.0343934 0.9995524
## 57 57 660 697.20 1.0216519 0.9265815
## 58 58 613 702.20 0.9971538 0.8754624
## 59 59 507 708.45 0.9631256 0.7430463
## 60 60 773 709.70 1.0343934 1.0529771
## 61 61 809 704.10 1.0216519 1.1246341
## 62 62 870 705.20 0.9971538 1.2372139
## 63 63 683 710.25 0.9631256 0.9984505
## 64 64 810 720.85 1.0343934 1.0863115
## 65 65 616 719.20 1.0216519 0.8383553
## 66 66 690 698.75 0.9971538 0.9902962
## 67 67 702 680.70 0.9631256 1.0707756
## 68 68 672 678.10 1.0343934 0.9580535
## 69 69 660 678.80 1.0216519 0.9516980
## 70 70 587 675.95 0.9971538 0.8708861
## 71 71 586 682.85 0.9631256 0.8910240
## 72 72 732 682.65 1.0343934 1.0366383
## 73 73 769 676.95 1.0216519 1.1119028
## 74 74 738 678.60 0.9971538 1.0906373
## 75 75 631 691.65 0.9631256 0.9472401
## 76 76 813 712.65 1.0343934 1.1028806
## 77 77 575 720.40 1.0216519 0.7812521
## 78 78 685 711.60 0.9971538 0.9653671
## 79 79 680 708.35 0.9631256 0.9967313
## 80 80 828 724.80 1.0343934 1.1044000
## 81 81 765 740.50 1.0216519 1.0111916
## 82 82 708 756.90 0.9971538 0.9380643
## 83 83 617 779.80 0.9631256 0.8215217
## 84 84 825 799.10 1.0343934 0.9980839
## 85 85 873 808.35 1.0216519 1.0570898
## 86 86 885 819.05 0.9971538 1.0836043
## 87 87 831 835.95 0.9631256 1.0321381
## 88 88 887 862.70 1.0343934 0.9939810
## 89 89 864 882.90 1.0216519 0.9578539
## 90 90 829 879.40 0.9971538 0.9453789
## 91 91 978 877.00 0.9631256 1.1578608
## 92 92 833 892.75 1.0343934 0.9020475
## 93 93 1027 917.20 1.0216519 1.0959821
## 94 94 819 935.45 0.9971538 0.8780135
## 95 95 809 953.25 0.9631256 0.8811682
## 96 96 901 968.30 1.0343934 0.8995579
## 97 97 1130 991.80 1.0216519 1.1151965
## 98 98 1077 1017.25 0.9971538 1.0617588
## 99 99 1039 1035.90 0.9631256 1.0413934
## 100 100 1010 1064.80 1.0343934 0.9169963
## 101 101 1098 1094.30 1.0216519 0.9821165
## 102 102 1183 1102.75 0.9971538 1.0758347
## 103 103 1186 1109.95 0.9631256 1.1094261
## 104 104 1033 1137.80 1.0343934 0.8777051
## 105 105 1173 1169.30 1.0216519 0.9819042
## 106 106 1127 1198.75 0.9971538 0.9428295
## 107 107 1073 1230.50 0.9631256 0.9053890
## 108 108 1278 1248.35 1.0343934 0.9897118
## 109 109 1395 1280.10 1.0216519 1.0666633
## 110 110 1284 NA 0.9971538 NA
## 111 111 1413 NA 0.9631256 NA
## 112 112 1503 NA 1.0343934 NA
## 113 113 1223 NA 1.0216519 NA
## 114 114 1631 NA 0.9971538 NA
##
## [[2]]
## TableGrob (2 x 2) "arrange": 4 grobs
## z cells name grob
## 1 1 (1-1,1-1) arrange gtable[layout]
## 2 2 (1-1,2-2) arrange gtable[layout]
## 3 3 (2-2,1-1) arrange gtable[layout]
## 4 4 (2-2,2-2) arrange gtable[layout]
serie1<-c(as.numeric(fecha[10], "%y"), as.numeric(fecha[10], "%m"))
s2<-ts(series[800,-c(1:7)] %>% t() %>% na.omit(),frequency = 12, start=serie1[1] )
separa(s2,"aditiva",10,10)## [[1]]
## Tiempo Serie Tendencia Estacionalidad Comp_Aleatorio
## 1 1 83 NA 3.648485 NA
## 2 2 86 NA 5.211765 NA
## 3 3 86 NA 1.038235 NA
## 4 4 89 NA -10.174242 NA
## 5 5 90 NA 3.648485 NA
## 6 6 88 82.65 5.211765 0.13823529
## 7 7 79 83.05 1.038235 -5.08823529
## 8 8 43 83.05 -10.174242 -29.87575758
## 9 9 87 83.05 3.648485 0.30151515
## 10 10 91 82.80 5.211765 2.98823529
## 11 11 92 82.55 1.038235 8.41176471
## 12 12 85 82.90 -10.174242 12.27424242
## 13 13 87 85.55 3.648485 -2.19848485
## 14 14 88 87.30 5.211765 -4.51176471
## 15 15 86 84.55 1.038235 0.41176471
## 16 16 87 82.00 -10.174242 15.17424242
## 17 17 87 81.80 3.648485 1.55151515
## 18 18 88 81.90 5.211765 0.88823529
## 19 19 77 81.70 1.038235 -5.73823529
## 20 20 46 81.35 -10.174242 -25.17575758
## 21 21 86 81.30 3.648485 1.05151515
## 22 22 87 81.35 5.211765 0.43823529
## 23 23 87 81.25 1.038235 4.71176471
## 24 24 84 81.65 -10.174242 12.52424242
## 25 25 83 84.15 3.648485 -4.79848485
## 26 26 89 85.80 5.211765 -2.01176471
## 27 27 86 83.30 1.038235 1.66176471
## 28 28 87 81.15 -10.174242 16.02424242
## 29 29 86 81.35 3.648485 1.00151515
## 30 30 87 81.85 5.211765 -0.06176471
## 31 31 78 81.90 1.038235 -4.93823529
## 32 32 45 81.65 -10.174242 -26.47575758
## 33 33 86 81.55 3.648485 0.80151515
## 34 34 89 81.65 5.211765 2.13823529
## 35 35 88 81.35 1.038235 5.61176471
## 36 36 85 81.35 -10.174242 13.82424242
## 37 37 85 84.05 3.648485 -2.69848485
## 38 38 86 85.80 5.211765 -5.01176471
## 39 39 89 83.30 1.038235 4.66176471
## 40 40 78 81.30 -10.174242 6.87424242
## 41 41 87 81.55 3.648485 1.80151515
## 42 42 90 82.05 5.211765 2.73823529
## 43 43 76 82.40 1.038235 -7.43823529
## 44 44 49 82.50 -10.174242 -23.32575758
## 45 45 88 83.20 3.648485 1.15151515
## 46 46 90 84.25 5.211765 0.53823529
## 47 47 90 84.80 1.038235 4.16176471
## 48 48 88 84.15 -10.174242 14.02424242
## 49 49 89 84.60 3.648485 0.75151515
## 50 50 92 85.55 5.211765 1.23823529
## 51 51 94 83.25 1.038235 9.71176471
## 52 52 94 81.40 -10.174242 22.77424242
## 53 53 59 82.10 3.648485 -26.74848485
## 54 54 75 83.35 5.211765 -13.56176471
## 55 55 81 84.30 1.038235 -4.33823529
## 56 56 51 84.85 -10.174242 -23.67575758
## 57 57 92 85.40 3.648485 2.95151515
## 58 58 100 87.70 5.211765 7.08823529
## 59 59 102 91.05 1.038235 9.91176471
## 60 60 98 93.60 -10.174242 14.57424242
## 61 61 99 97.45 3.648485 -2.09848485
## 62 62 100 99.80 5.211765 -5.01176471
## 63 63 99 97.15 1.038235 0.81176471
## 64 64 102 94.65 -10.174242 17.52424242
## 65 65 105 94.80 3.648485 6.55151515
## 66 66 104 95.50 5.211765 3.28823529
## 67 67 86 96.05 1.038235 -11.08823529
## 68 68 53 96.60 -10.174242 -33.42575758
## 69 69 99 97.45 3.648485 -2.09848485
## 70 70 104 98.05 5.211765 0.73823529
## 71 71 107 98.45 1.038235 7.51176471
## 72 72 103 99.85 -10.174242 13.32424242
## 73 73 107 103.55 3.648485 -0.19848485
## 74 74 111 105.55 5.211765 0.23823529
## 75 75 108 102.45 1.038235 4.51176471
## 76 76 109 99.65 -10.174242 19.52424242
## 77 77 109 99.45 3.648485 5.90151515
## 78 78 104 99.45 5.211765 -0.66176471
## 79 79 88 98.75 1.038235 -11.78823529
## 80 80 53 97.90 -10.174242 -34.72575758
## 81 81 102 97.55 3.648485 0.80151515
## 82 82 104 97.20 5.211765 1.58823529
## 83 83 106 96.95 1.038235 8.01176471
## 84 84 98 97.55 -10.174242 10.62424242
## 85 85 104 100.45 3.648485 -0.09848485
## 86 86 106 101.75 5.211765 -0.96176471
## 87 87 105 98.40 1.038235 5.56176471
## 88 88 103 95.80 -10.174242 17.37424242
## 89 89 101 95.95 3.648485 1.40151515
## 90 90 98 96.30 5.211765 -3.51176471
## 91 91 83 96.00 1.038235 -14.03823529
## 92 92 56 95.60 -10.174242 -29.42575758
## 93 93 102 95.60 3.648485 2.75151515
## 94 94 105 95.90 5.211765 3.88823529
## 95 95 104 96.55 1.038235 6.41176471
## 96 96 100 98.30 -10.174242 11.87424242
## 97 97 103 102.10 3.648485 -2.74848485
## 98 98 105 103.80 5.211765 -4.01176471
## 99 99 105 100.75 1.038235 3.21176471
## 100 100 107 98.60 -10.174242 18.57424242
## 101 101 109 99.10 3.648485 6.25151515
## 102 102 106 99.90 5.211765 0.88823529
## 103 103 86 100.40 1.038235 -15.43823529
## 104 104 60 100.75 -10.174242 -30.57575758
## 105 105 106 101.40 3.648485 0.95151515
## 106 106 108 102.10 5.211765 0.68823529
## 107 107 111 102.80 1.038235 7.16176471
## 108 108 107 104.70 -10.174242 12.47424242
## 109 109 110 109.00 3.648485 -2.64848485
## 110 110 115 111.10 5.211765 -1.31176471
## 111 111 115 108.15 1.038235 5.81176471
## 112 112 114 105.85 -10.174242 18.32424242
## 113 113 116 106.20 3.648485 6.15151515
## 114 114 116 107.05 5.211765 3.73823529
## 115 115 92 107.35 1.038235 -16.38823529
## 116 116 63 107.55 -10.174242 -34.37575758
## 117 117 110 108.45 3.648485 -2.09848485
## 118 118 115 109.35 5.211765 0.43823529
## 119 119 119 109.95 1.038235 8.01176471
## 120 120 112 111.90 -10.174242 10.27424242
## 121 121 122 116.40 3.648485 1.95151515
## 122 122 125 118.80 5.211765 0.98823529
## 123 123 123 116.00 1.038235 5.96176471
## 124 124 121 113.65 -10.174242 17.52424242
## 125 125 126 114.10 3.648485 8.25151515
## 126 126 119 114.35 5.211765 -0.56176471
## 127 127 102 113.35 1.038235 -12.38823529
## 128 128 67 111.70 -10.174242 -34.52575758
## 129 129 120 110.20 3.648485 6.15151515
## 130 130 120 108.40 5.211765 6.38823529
## 131 131 119 106.50 1.038235 11.46176471
## 132 132 108 105.15 -10.174242 13.02424242
## 133 133 107 106.40 3.648485 -3.04848485
## 134 134 107 106.00 5.211765 -4.21176471
## 135 135 104 100.50 1.038235 2.46176471
## 136 136 103 96.10 -10.174242 17.07424242
## 137 137 91 94.35 3.648485 -6.99848485
## 138 138 103 93.45 5.211765 4.33823529
## 139 139 76 92.45 1.038235 -17.48823529
## 140 140 54 NA -10.174242 NA
## 141 141 97 NA 3.648485 NA
## 142 142 95 NA 5.211765 NA
## 143 143 102 NA 1.038235 NA
## 144 144 92 NA -10.174242 NA
##
## [[2]]
## TableGrob (2 x 2) "arrange": 4 grobs
## z cells name grob
## 1 1 (1-1,1-1) arrange gtable[layout]
## 2 2 (1-1,2-2) arrange gtable[layout]
## 3 3 (2-2,1-1) arrange gtable[layout]
## 4 4 (2-2,2-2) arrange gtable[layout]