dummyseas | R Documentation |
It produces a matrix with seasonal dummies summing to zero
to be used as regressors. If s
is the seasonal period,
then the j
-th dummy equals 1 in season j
and
-1/(s-1)
in the other seasons, so that the variable
sums to 0 over one year period.
dummyseas(n, s, remove = s)
n |
length of time series; |
s |
seasonal period; |
remove |
to avoid collinearity with the constant remove a column, by default it is column s; if NULL no column is removed. |
It returns a matrix with n
rows and s-1
column unless remove = NULL
.
y <- log(AirPassengers)
X <- dummyseas(length(y), 12)
X <- cbind(X, t = 1:length(y))
reg <- lm(y~X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.