I use the decompose function in R and come up with the 3 components of my monthly time series (trend, seasonal and random). If I plot the chart or look at the table, I can clearly see that the time series is affected by seasonality.

However, when I regress the time series onto the 11 seasonal dummy variables, all the coefficients are not statistically significant, suggesting there is no seasonality.

I don't understand why I come up with two very different results. Did this happen to anybody? Am I doing something wrong?

I add here some useful details.

This is my time series and the corresponding monthly change. In both charts, you can see there is seasonality (or this is what I would like to assess). Especially, in the second chart (which is the monthly change of the series) I can see a recurrent pattern (high points and low points in the same months of the year).



Below is the output of the decompose function. I appreciate that, as @RichardHardy said, the function does not test whether there is actual seasonality. But the decomposition seems to confirm what I think.


However, when I regress the time series on 11 seasonal dummy variables (January to November, excluding December) I find the following:

                  Estimate Std. Error t value Pr(>|t|)    
    (Intercept) 5144454056  372840549  13.798   <2e-16 ***
    Jan     -616669492  527276161  -1.170    0.248    
    Feb     -586884419  527276161  -1.113    0.271    
    Mar     -461990149  527276161  -0.876    0.385    
    Apr     -407860396  527276161  -0.774    0.443    
    May     -395942771  527276161  -0.751    0.456    
    Jun     -382312331  527276161  -0.725    0.472    
    Jul     -342137426  527276161  -0.649    0.520    
    Aug     -308931830  527276161  -0.586    0.561    
    Sep     -275129629  527276161  -0.522    0.604    
    Oct     -218035419  527276161  -0.414    0.681    
    Nov     -159814080  527276161  -0.303    0.763

Basically, all the seasonality coefficients are not statistically significant.

To run linear regression I use the following function:

lm.r = lm(Yvar~Var$Jan+Var$Feb+Var$Mar+Var$Apr+Var$May+Var$Jun+Var$Jul+Var$Aug+Var$Sep+Var$Oct+Var$Nov)

where I set up Yvar as a time series variable with monthly frequency (frequency = 12).

I also try to take into account the trending component of the time series including a trend variable to the regression. However, the result does not change.

                  Estimate Std. Error t value Pr(>|t|)    
    (Intercept) 3600646404   96286811  37.395   <2e-16 ***
    Jan     -144950487  117138294  -1.237    0.222    
    Feb     -158048960  116963281  -1.351    0.183    
    Mar      -76038236  116804709  -0.651    0.518    
    Apr      -64792029  116662646  -0.555    0.581    
    May      -95757949  116537153  -0.822    0.415    
    Jun     -125011055  116428283  -1.074    0.288    
    Jul     -127719697  116336082  -1.098    0.278    
    Aug     -137397646  116260591  -1.182    0.243    
    Sep     -146478991  116201842  -1.261    0.214    
    Oct     -132268327  116159860  -1.139    0.261    
    Nov     -116930534  116134664  -1.007    0.319    
    trend     42883546    1396782  30.702   <2e-16 ***

Hence my question is: am I doing something wrong in the regression analysis?

  • 1
    $\begingroup$ @forecaster, here is an answer to your question (OP says decompose function in R is used). $\endgroup$ – Richard Hardy Mar 12 '15 at 14:23
  • 1
    $\begingroup$ Reading the help file of the decompose function, it seems that the function does not test whether there is seasonality. Instead, it just obtains averages for each season, subtracts the mean and calls this the seasonal component. So it would produce a seasonal component regardless of whether there is true underlying seasonal component or just noise. Nevertheless, this does not explain why your dummies are insignificant though you say the seasonality is visible from a plot of the data. Could it be that your sample is too small to get significant seasonal dummies? Are they jointly significant? $\endgroup$ – Richard Hardy Mar 12 '15 at 14:30
  • 3
    $\begingroup$ You need to look at the scales, seasonal chart shows seasonal variation is between -0.02 and +0.04, while the actual values range from 4 billion to 6 billion. Decompose function forces your data to show some seasonality that is why it is showing a value that is negligible. There is no seasonality in your data. $\endgroup$ – forecaster Mar 12 '15 at 21:01
  • 1
    $\begingroup$ I thought seasonality is more about movements with a certain "fixed" frequency rather than the magnitude of the movement. The scales are different as the first chart shows a balance (in terms of pounds) and the second is the change (expressed in percentage terms). I've just tried to re-run the regression: if I take into account a polynomial trend, some coefficient starts to be significant. I guess, as @danno suggested, the trend is very significant. $\endgroup$ – mattiace Mar 12 '15 at 21:11
  • 1
    $\begingroup$ The Canova and Hansen test may give your some further information about the presence and stability of a seasonal pattern in your data. For some applications of this test see for example this post, which also gives the link to the original paper and to sample code. $\endgroup$ – javlacalle Mar 12 '15 at 21:40

Are you doing the regression on the data after you've removed the trend? You have a positive trend, and your seasonal signature is likely masked in your regression (variance due to trend, or error, is larger than due to month), unless you've accounted for the trend in Yvar...

Also, I'm not terribly confident with time series, but shouldn't each observation be assigned a month, and your regression look something like this?

lm(Yvar ~ Time + Month)

Apologies if that makes no sense... Does regression make the most sense here?

  • $\begingroup$ I read on an Econometrics textbook (Wooldridge) that if you introduce a "time" factor in the regression, it's like de-trending your original time series. For "time" factor I mean a vector such as [1, 2, ..., n] with n = to the number of observations. I don't really get your second point. My second regression looks like the following: lm.r = lm(Yvar~Var$Time+Var$Jan+Var$Feb+...+Var$Nov). Is this what you meant? $\endgroup$ – mattiace Mar 12 '15 at 20:13
  • $\begingroup$ It would help to see a few lines of your data. But, I imagine that you've got three columns, Time, Yvar, Month. The rows are observations. Thus, I would think the factors in your lm() would be Time and Month (not the factor levels of Month). Also, I think there are some issues with lm() on time series... the observation are not independent - temporally autocorrelated. $\endgroup$ – danno Mar 14 '15 at 20:18

In your graphical depiction of the time series, it is obvious that "trend"--a linear component in time--is the singlemost substantial contributor to the realization. We would comment that the most important aspect of this time series is the stable rise each month.

After that, I would comment that the seasonal variation is miniscule by comparison. It is not surprising, therefore, with monthly measures taken over 6 years (a total of only 72 observations) the linear regression model fails to have the precision to identify any of the 11 month-contrasts as statistically significant. It is furthermore not surprising that the time effect does achieve statistical significance, because it is the same approximately consistent linear increase occurring over all 72 observations, conditional upon their seasonal effect.

The lack of statistical significance for any of the 11 month contrasts does not mean that there are no seasonal effects. In fact, if you were to use a regression model to determine whether there is any seasonality, the appropriate test is the nested 11 degree of freedom test which simultaneously assesses the statistical significance of each month contrast. You would obtain such a test by conducting an ANOVA, likelihood ratio test, or robust Wald test. For instance:

library(lmtest) model.mt <- lm(outcome ~ time + month) model.t <- lm(outcome ~ time) aov(model.mt, model.t) lrtest(model.mt, model.t) library(sandwich) ## autoregressive consistent robust standard errors waldtest(lrtest, lmtest, vcov.=function(x)vcovHAC(x))


I don't know if it's your case, but that happened to me when I started analyzing time series in R and the issue was that I hadn't correctly stated the time series period when creating the time series object to decompose it. There is a parameter in the time series function that lets you specify its frequency. Doing so, it correctly decomposes its seasonal trends.

  • $\begingroup$ jmnavarro, I defined the frequency correctly in the decompose function (=12 as I have monthly data). In fact, I'm happy with the outcome of this function. My question is why I don't find the same result (seasonality is significant) when I do linear regression using dummy variables. I did it both with R and excel and the results is the same: dummy coefficients not statistically significant. This is against what I have previously found in the decompose function. I don't understand if I am missing something out here $\endgroup$ – mattiace Mar 12 '15 at 12:08
  • $\begingroup$ True, sorry, I did not completely understand your question. It would help if you could post your code, so we could try and reproduce it. $\endgroup$ – jmnavarro Mar 12 '15 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.