Module 12. Assignment
> Charge<-c(31.9,27,31.3,31,39.4,40.7,42.3,49.5,45,50,50.9,58.5,39.4,36.2,40.5,44.6,46.8,44.7,52.2,54,48.8 ,55.8,58.7,63.4)
> Chargetimeseries <-ts(Charge)
> Chargetimeseries <-ts(Charge,frequency=12,start=c(2012,1))
> Chargetimeseries
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2012 31.9 27.0 31.3 31.0 39.4 40.7 42.3 49.5 45.0 50.0 50.9 58.5
2013 39.4 36.2 40.5 44.6 46.8 44.7 52.2 54.0 48.8 55.8 58.7 63.4
> Chargeforecast<-HoltWinters(Chargetimeseries)
> summary(Chargeforecast)
Length Class Mode
fitted 48 mts numeric
x 24 ts numeric
alpha 1 -none- numeric
beta 1 -none- numeric
gamma 1 -none- numeric
coefficients 14 -none- numeric
seasonal 1 -none- character
SSE 1 -none- numeric
call 2 -none- call > plot(Chargeforecast)
Alpha is how the model reacts to the data. Beta controls the trends, whether they increase or decrease over time. Gamma controls the patterns of how often it spikes up or drops down. SSE is the difference between the actual data and the predicted model.
In the graph, the black line represents the actual observed data points, and the predicted values are in red. As shown in the graph, the red line is somewhat close to, if not similar to, the black line's pattern, showing that the model is doing a good job capturing the pattern in the data.
The close match between observed and fitted values suggests it provides a reliable forecast for predictions as long as the data continues to follow similar patterns.
Comments
Post a Comment