Description Usage Arguments Details Value See Also Examples
A replacement for the genhol software by the U.S. Census Bureau, a utility that uses the same procedure as X12ARIMA to create regressors for the U. S. holidays of Easter, Labor Day, and Thanksgiving. This is a replacement written in R, the U.S. Census Bureau software is not needed.
1 
x 
a vector of class 
start 
integer, shifts the start point of the holiday. Use negative
values if 
end 
integer, shifts end point of the holiday. Use negative values if

frequency 
integer, frequency of the resulting series 
center 
character string. Either 
The resulting time series can be used as a user defined variable in
seas()
. Usually, you want the holiday effect to be removed from
the final series, so you need to specify regression.usertype = "holiday"
. (The default is to include user defined variables in the final
series.)
an object of class "ts"
that can be used as a user defined
variable in seas()
.
seas()
for the main function of seasonal.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119  data(holiday) # dates of Chinese New Year, Indian Diwali and Easter
### use of genhol
# 10 day before Easter day to one day after, quarterly data:
genhol(easter, start = 10, end = 1, frequency = 4)
genhol(easter, frequency = 2) # easter is allways in the first halfyear
# centering for overall mean or monthly calendar means
genhol(easter, center = "mean")
genhol(easter, center = "calendar")
### replicating X13's builtin Easter adjustment
# builtin
m1 < seas(x = AirPassengers,
regression.variables = c("td1coef", "easter[1]", "ao1951.May"),
arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL,
outlier = NULL, transform.function = "log", x11 = "")
summary(m1)
# user defined variable
ea1 < genhol(easter, start = 1, end = 1, center = "calendar")
# regression.usertype = "holiday" ensures that the effect is removed from
# the final series.
m2 < seas(x = AirPassengers,
regression.variables = c("td1coef", "ao1951.May"),
xreg = ea1, regression.usertype = "holiday",
arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL,
outlier = NULL, transform.function = "log", x11 = "")
summary(m2)
all.equal(final(m2), final(m1), tolerance = 1e06)
# with genhol, its possible to do sligtly better, by adjusting the length
# of easter from Friday to Monday:
ea2 < genhol(easter, start = 2, end = +1, center = "calendar")
m3 < seas(x = AirPassengers,
regression.variables = c("td1coef", "ao1951.May"),
xreg = ea2, regression.usertype = "holiday",
arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL,
outlier = NULL, transform.function = "log", x11 = "")
summary(m3)
### Chinese New Year
data(seasonal)
data(holiday) # dates of Chinese New Year, Indian Diwali and Easter
# de facto holiday length: http://en.wikipedia.org/wiki/Chinese_New_Year
cny.ts < genhol(cny, start = 0, end = 6, center = "calendar")
m1 < seas(x = imp, xreg = cny.ts, regression.usertype = "holiday", x11 = "",
regression.variables = c("td1coef", "ls1985.Jan", "ls2008.Nov"),
arima.model = "(0 1 2)(0 1 1)", regression.aictest = NULL,
outlier = NULL, transform.function = "log")
summary(m1)
# compare to identical noCNY model
m2 < seas(x = imp, x11 = "",
regression.variables = c("td1coef", "ls1985.Jan", "ls2008.Nov"),
arima.model = "(0 1 2)(0 1 1)", regression.aictest = NULL,
outlier = NULL, transform.function = "log")
summary(m2)
ts.plot(final(m1), final(m2), col = c("red", "black"))
# modeling complex holiday effects in Chinese imports
#  positive preCNY effect
#  negative postCNY effect
pre_cny < genhol(cny, start = 6, end = 1, frequency = 12, center = "calendar")
post_cny < genhol(cny, start = 0, end = 6, frequency = 12, center = "calendar")
m3 < seas(x = imp, x11 = "",
xreg = cbind(pre_cny, post_cny), regression.usertype = "holiday",
x11 = list())
summary(m3)
### Indian Diwali (thanks to Pinaki Mukherjee)
# adjusting Indian industrial production
m4 < seas(iip,
x11 = "",
xreg = genhol(diwali, start = 0, end = 0, center = "calendar"),
regression.usertype = "holiday"
)
summary(m4)
# without specification of 'regression.usertype', Diwali effects are added
# back to the final series
m5 < seas(iip,
x11 = "",
xreg = genhol(diwali, start = 0, end = 0, center = "calendar")
)
ts.plot(final(m4), final(m5), col = c("red", "black"))
# plot the Diwali factor in Indian industrial production
plot(series(m4, "regression.holiday"))
### Using genhol to replicate the regARIMA estimation in R
# easter regressor
ea < genhol(easter, start = 1, end = 1, center = "calendar")
ea < window(ea, start = start(AirPassengers), end = end(AirPassengers))
# estimating ARIMA model in R base
arima(log(AirPassengers), order = c(0,1,1), seasonal = c(0,1,1), xreg = ea)
summary(seas(AirPassengers, regression.variables = c("easter[1]"),
regression.aictest = NULL))
# Note that R defines the ARIMA model with negative signs before the MA term,
# X13 with a positive sign.

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.