Module 12 assignment
Module 12:
Code:
#Time Series for a Student Credit Card
#part a
#install.packages("timeSeries")
#install.packages("timeDate")
library(timeDate)
library(timeSeries)
require(timeSeries)
creditstudent <- 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)
creditts <- ts(creditstudent, frequency=12, start=c(2012,1))
plot.ts(creditts)
#part b
creditpartb <- HoltWinters(x = creditts, beta = FALSE, gamma = FALSE)
creditpartb
#the observed and forecasted values re pretty close in similarity but appears to lag. This is in the perspective of
## the forecasted values against the actual observed values.
##More importantly the plot is shown without trend or seasonal component. This format of analysis decreases the weight of the vaue corresponded to time as time progresses onwards.
Console:
> #Time Series for a Student Credit Card
> #part a
>
> #install.packages("timeSeries")
> #install.packages("timeDate")
>
> library(timeDate)
> library(timeSeries)
>
>
> require(timeSeries)
>
>
> creditstudent <- 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)
>
> creditts <- ts(creditstudent, frequency=12, start=c(2012,1))
>
> plot.ts(creditts)
>
> #part b
>
> creditpartb <- HoltWinters(x = creditts, beta = FALSE, gamma = FALSE)
>
> creditpartb
Holt-Winters exponential smoothing without trend and without seasonal component.
Call:
HoltWinters(x = creditts, beta = FALSE, gamma = FALSE)
Smoothing parameters:
alpha: 0.8232442
beta : FALSE
gamma: FALSE
Coefficients:
[,1]
a 62.44453
>
> #the observed and forecasted values re pretty close in similarity but appears to lag. This is in the perspective of
> ## the forecasted values against the actual observed values.
>
> ##More importantly the plot is shown without trend or seasonal component. This format of analysis decreases the weight of the vaue corresponded to time as time progresses onwards.
Comments
Post a Comment