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-helpPLEASE do read the posting guide

http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.