library(readxl)
## Warning: package 'readxl' was built under R version 4.5.1
library(writexl)
## Warning: package 'writexl' was built under R version 4.5.1
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.5.1
datos1=read_excel("oferta.xlsx",sheet = 2)
head(datos1,3)
## # A tibble: 3 × 1
## OFERTA
## <dbl>
## 1 17560884.
## 2 18110589.
## 3 19138105.
d1s=ts(datos1/1000000,start = 1988,frequency = 1)
plot(d1s)
## Pronostico
d1sw=HoltWinters(d1s,gamma = F)
d1sp=predict(d1sw,3)
d1sp
## Time Series:
## Start = 2025
## End = 2027
## Frequency = 1
## fit
## [1,] 64.21191
## [2,] 65.35158
## [3,] 66.49126
plot(d1sw,d1sp,main="Oferta final")
## Guardar datos
Periodo=seq(1988,2027,1)
Oferta_Millones=rbind(d1s,d1sp)
Dato=c(rep("Real",37),rep("Pronosticado",3))
Datos_oferta=data.frame(Periodo,Oferta_Millones,Dato)
write_xlsx(Datos_oferta,"dato_oferta.xlsx")
ggplot(Datos_oferta,
aes(x=Periodo,y=Oferta_Millones,col=Dato))+
geom_line()+
geom_point()+
theme_bw()