Reputation: 1
Time series Date Sales 1 Jan-95 1664.81 2 Feb-95 2397.53 3 Mar-95 2840.71 4 Apr-95 3547.29 5 May-95 3752.96 6 Jun-95 3714.74 7 Jul-95 4349.61 8 Aug-95 3566.34 9 Sep-95 5021.82
This is the time series code : t<-ts(data$Sales,frequency=12,start=c(1995,1))
This is the task I have to perform : Fit a linear trend model with additive seasonality (Model A) and exponential trend model with multiplicative seasonality (Model B). Consider January as the reference group for each model.
Upvotes: 0
Views: 70
Reputation: 12548
As r2evans has said, it's difficult/impossible to solve conclusively without seeing the timeseries you created, as the frequency would determine the answer. But here is an answer which should work regardless of the frequency:
freq <- 12
# create a timeseries object
data <- ts(data = 1:1000, start = c(2010, 1), frequency = freq)
# seq() in this case creates a sequence of numbers from 1 to the length of the data, with a step of freq
data[seq(1, length(data), freq)]
Upvotes: 0