View source: R/spec_regarima.R
set_tradingdays | R Documentation |
Function allowing to select the trading-days regressors to be used for
calendar correction in the pre-processing step of a seasonal adjustment
procedure. The default is "TradingDays"
, with easter specific effect
enabled. (see set_easter
)
All the built-in regressors are meant to correct for type of day effect but don't take into account any holiday. To do so user-defined regressors have to be built.
set_tradingdays(
x,
option = c(NA, "TradingDays", "WorkingDays", "TD3", "TD3c", "TD4", "None",
"UserDefined"),
calendar.name = NA,
uservariable = NA,
stocktd = NA,
test = c(NA, "None", "Remove", "Add", "Separate_T", "Joint_F"),
coef = NA,
coef.type = c(NA, "Fixed", "Estimated"),
automatic = c(NA, "Unused", "FTest", "WaldTest", "Aic", "Bic"),
pftd = NA,
autoadjust = NA,
leapyear = c(NA, "LeapYear", "LengthOfPeriod", "None"),
leapyear.coef = NA,
leapyear.coef.type = c(NA, "Fixed", "Estimated")
)
x |
the specification to customize, must be a "SPEC" class object (see details). |
option |
to specify the set of trading days regression variables:
|
calendar.name |
name (string) of the user-defined calendar to be taken into account when generating built-in regressors set in 'option' (if not 'UserDefined).(see examples) |
uservariable |
a vector of characters to specify the name of user-defined calendar regressors.
When specified, automatically set |
stocktd |
a numeric indicating the day of the month when inventories and other stock are reported
(to denote the last day of the month, set the variable to 31).
When specified, automatically set |
test |
defines the pre-tests for the significance of the trading day regression variables
based on the AICC statistics: (REGARIMA/X-13 specific)
(TRAMO specific)
|
coef |
vector of coefficients for the trading-days regressors. |
coef.type , leapyear.coef.type |
vector defining if the coefficients are fixed or estimated. |
automatic |
defines whether the calendar effects should be added to the
model manually ( |
pftd |
(TRAMO SPECIFIC) |
autoadjust |
a logical indicating if the program corrects automatically the raw series for the leap year effect if the leap year regressor is significant. Only used when the data is log transformed. |
leapyear |
a |
leapyear.coef |
coefficient of the leap year regressor. |
x
specification parameter must be a JD3_X13_SPEC" class object generated with rjd3x13::x13_spec()
(or "JD3_REGARIMA_SPEC" generated with rjd3x13::spec_regarima()
or "JD3_TRAMOSEATS_SPEC"
generated with rjd3tramoseats::spec_tramoseats()
or "JD3_TRAMO_SPEC" generated with
rjd3tramoseats::spec_tramo()
).
More information on calendar correction in JDemetra+ online documentation: https://jdemetra-new-documentation.netlify.app/a-calendar-correction
modelling_context
, calendar_td
# Pre-defined regressors
# y_raw<-ABS$X0.2.09.10.M
# init_spec <- rjd3x13::x13_spec("RSA5c")
# new_spec<-set_tradingdays(init_spec,
# option = "TD4",
# test = "None",
# coef=c(0.7,NA,0.5),
# coef.type=c("Fixed","Estimated","Fixed"),
# leapyear="LengthOfPeriod",
# leapyear.coef=0.6)
# sa<-rjd3x13::x13(y_raw,new_spec)
# Pre-defined regressors based on user-defined calendar
### create a calendar
BE <- national_calendar(list(
fixed_day(7, 21),
special_day("NEWYEAR"),
special_day("CHRISTMAS"),
special_day("MAYDAY"),
special_day("EASTERMONDAY"),
special_day("ASCENSION"),
special_day("WHITMONDAY"),
special_day("ASSUMPTION"),
special_day("ALLSAINTSDAY"),
special_day("ARMISTICE")
))
## put into a context
my_context <- modelling_context(calendars = list(cal = BE))
## create a specification
# init_spec <- rjd3x13::x13_spec("RSA5c")
## modify the specification
# new_spec<-set_tradingdays(init_spec,
# option = "TradingDays", calendar.name="cal")
## estimate with context
# sa<-rjd3x13::x13(y_raw,new_spec, context=my_context)
# User-defined regressors
# init_spec <- rjd3x13::x13_spec("RSA5c")
# add regressors to context
# variables<-list(Monday,Tuesday, Wednesday,
# Thursday, Friday, Saturday)
# my_context<-modelling_context(variables=variables)
# create a new spec (here default group name: r)
# new_spec<-set_tradingdays(init_spec,
# option = "UserDefined",
# uservariable=c("r.Monday","r.Tuesday","r.Wednesday","r.Thursday","r.Friday","r.Saturday"),
# test = "None")
# estimate with context
# sa<-rjd3x13::x13(y_raw,new_spec, context=my_context)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.