For this discussion, I chose data set: Appliances energy prediction Data Set which contains Experimental data used to create regression models of appliances energy use in a low energy building.
library(fpp2)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
## ── Attaching packages ──────────────────────────────────────── fpp2 2.4 ──
## ✓ ggplot2 3.3.2 ✓ fma 2.4
## ✓ forecast 8.13 ✓ expsmooth 2.3
##
Energy <- read.csv("~/Desktop/energydata_complete.csv")
energy<-ts(Energy,start=c(1976,1,1),end=c(2020,9,1),frequency=12)
autoplot(energy)
decomp.add = decompose(energy,type="additive")
decomp.multi = decompose(energy, type = "multiplicative")
Here, we are seeing a quite similar result from additive and multiplicative decomposition, same situation with the value of remainder values,hence we can go with either on; I chose to stick with addictive decompose for this data set
Build STL Model decomposition
stl.energy.add=stl(energy[,1],s.window = "periodic")
stl.energy.mult=stl(log(energy[,1]),s.window="periodic")
autoplot(stl.energy.add) + ggtitle("STL model-additive decomposition of Applliances Energy Prediction")
autoplot(stl.energy.mult) + ggtitle("STL model-Multiplitative decomposition of Applliances Energy Prediction")
Just like the classical decomposition, we see a similiar result from the STL model
autoplot(naive.stl<-forecast(stl.energy.add,method="naive"))