x12 ARIMA Moving Seasonality F Test Issue

classic Classic list List threaded Threaded
2 messages Options
sw1
Reply | Threaded
Open this post in threaded view
|

x12 ARIMA Moving Seasonality F Test Issue

sw1
I'm having a great deal of trouble replicating x12 ARIMA's F-test used to
detect moving seasonality. According to all literature I could find, the
test is apparently a 2-way ANOVA with year and month as factors for the SI
ratios determined by x12's smoothing algorithm. Note the SI ratio is simply
the detrended series. The summary I get from manually running this 2-way
ANOVA using the final SI series from x12 is significantly different than the
summary given by R's x12 package and the actual x12 software. The 1-way
ANOVA for stable seasonality is consistent, however, so I assume the error
is in how I'm performing the 2-way ANOVA. Whether it's my design of the
F-test or something else, I don't know.

Here's the results from the two ANOVAs using x12:

For the 1-way ANOVA for stable seasonality I get:

    Test for the presence of seasonality assuming stability.

                           Sum of     Dgrs.of         Mean
                          Squares     Freedom        Square       F-Value
    Between months       23461.7861       11       2132.88965     191.610**
          Residual        1469.3431      132         11.13139
             Total       24931.1292      143

And for the 2-way ANOVA for moving seasonality:

  Moving Seasonality Test
                         Sum of     Dgrs.of         Mean
                        Squares     Freedom        Square       F-value
   Between Years         236.0512       11        21.459200       2.681*
           Error         968.4973      121         8.004110

Here's me doing it manually with some sample data:

library(x12)
library(TSA) ### for cycle function

data(AirPassengers)

x12path <- "C:/WinX12/x12a/x12a.exe"

x12out <- x12(AirPassengers,x12path=x12path,
       
period=12,automdl=TRUE,transform="auto",outlier=c("AO","LS"),forecast_years=
0)

si <- as.vector(x12out$d8) ### SI ratios -- i.e., final detrended series
mo <- factor(cycle(x12out$d8))
yr <- factor(floor(time(x12out$d8)))

summary(aov(si ~ mo)) ### test for stable seasonality
summary(aov(si ~ mo + yr)) ### test for moving seasonality; this one is
my problem

> summary(aov(si ~ mo))
             Df Sum Sq Mean Sq F value Pr(>F)    
mo           11 2.3462 0.21329   191.6 <2e-16 ***
Residuals   132 0.1469 0.00111                  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


> summary(aov(si ~ mo + yr))
             Df Sum Sq Mean Sq F value Pr(>F)    
mo           11 2.3462 0.21329 180.477 <2e-16 ***
yr           11 0.0039 0.00036   0.303  0.984    
Residuals   121 0.1430 0.00118                  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


So in sum, doing the test manually, the 2-way ANOVA for seasonality gives me
an F-value of 0.303 while x12 gives 2.781. This is a significant difference.
Any help would be fantastic!

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: x12 ARIMA Moving Seasonality F Test Issue

piaodegougou
This post has NOT been accepted by the mailing list yet.
I had the same problem. After reading some references, I found on page 5 of the following slides

http://epp.eurostat.ec.europa.eu/cache/ITY_PUBLIC/EWP-2012-001/EN/EWP-2012-001-EN.PDF

It says "The variable tested is the final estimation of the unmodified Seasonal-Irregular (SI) differences
absolute value, if the decomposition model is an additive one; or the SI ratio minus one absolute value, if the
decomposition model is a multiplicative one. "
AirPasssengers data are fitted using a multiplicative model, so you should do si<-abs(si-1), then you will get the same result with R's x12 package.

On how to decide between multiplicative and additive model, here is a reference on this site
http://www.stats.govt.nz/surveys_and_methods/methods/data-analysis/seasonal-adjustment/the-underlying-model.aspx#howdo
It says " Alternatively we can process the series through X-12-ARIMA, using first the multiplicative, then the additive decomposition. The decomposition that yields the higher stable seasonality F-value and the lower moving seasonality F-value is the preferable one."

I posted here because I was very confused and hoped someone else already answered the question here. Now more people can find the answer by googling and read the post.