library(readxl)
library(writexl)
library(ggplot2)
datos1=read_excel("Servicio.xlsx",2)
head(datos1, 3)
## # A tibble: 3 × 1
## servicio
## <dbl>
## 1 75463.
## 2 77304.
## 3 80065.
d1s=ts(datos1,start = 1980, frequency = 1)
plot(d1s)
## interpretación lo que podemos observar en el gráfico en 1980 hasta
2020 tiene una asendencia elevada
d1sw=HoltWinters(d1s,gamma = F)
d1sp=predict(d1sw,3)
plot(d1sw,d1sp,main="oferta final: 1980:2024")
### GUARDAR DATOS
Perido=seq(1980,2027,1)
servicio=rbind(d1s,d1sp)
Dato=c(rep("Real",45),rep("Pronosticado",3))
Datos_oferta=data.frame(Perido,servicio,Dato)
write_xlsx(Datos_oferta,"servicio.xlsx")
ggplot(Datos_oferta,aes(x=Perido,y=servicio,col=Dato))+
geom_line()+
geom_point()+
theme_bw()