Open froehlich1 opened 4 years ago
1. transform spec (pre-adjustment of the input series):
I cannot find any trace of this parameter in the RJDemetra output after it is set.
Example:
require(persephone)
x <- per_x13(AirPassengers, transform.function = "Log", transform.adjust = "LeapYear",
userdefined = c("preprocessing.model.lp","preprocessing.model.log"),
template = "RSA0")
x$run()
x$output$user_defined$preprocessing.model.lp
# NULL
x$output$user_defined$preprocessing.model.log
# [1] "true"
The only trace I can find of it is in the parameters slot itself:
x$params$regarima$transform
# tfunction adjust aicdiff
#Predefined None None -2
#User_modif Log LeapYear NA
#Final Log LeapYear -2
userdefvar <- RJDemetra::user_defined_variables(sa_object = c("X13-ARIMA"))
grep("lp", userdefvar, value=TRUE)
#[1] "preprocessing.model.lp" "diagnostics.seas-lin-spectralpeaks"
#[3] "diagnostics.seas-res-spectralpeaks" "diagnostics.seas-i-spectralpeaks"
#[5] "diagnostics.seas-sa-spectralpeaks"
grep("leap", userdefvar, value=TRUE)
#character(0)
2. regression spec (including the leap-year effect in the model):
I can't seem to find the right way to do this. According to the RJDemetra-R-help, the parameter is set as follows:
?RJDemetra::x13_spec
tradingdays.leapyear
:
option for including the leap-year effect in the model: "LeapYear" - leap year effect; "LengthOfPeriod" - length of period, "None" - no effect included. The leap-year effect can be pre-specified in the model only if the input series was not pre-adjusted (transform.adjust set to "None") and the automatic correction for the leap-year effect was not selected (tradingdays.autoadjust set to FALSE).
But with this, I get the following result where the leap year is not included in the model:
require(persephone)
x <- per_x13(AirPassengers, tradingdays.leapyear="LeapYear", transform.adjust="None",
tradingdays.autoadjust=FALSE,
template = "RSA0")
x$run()
x$output$regarima$model$spec_rslt
# Model T.span Log transformation Mean Trading days
#1 RegARIMA - X13 from 1-1949 to 12-1960 FALSE FALSE 0
# Leap year Easter Outliers
#1 FALSE FALSE 0
The only way I can get a result containing a leap year is by using the predefined model specification "RSA5c":
myseries <- persephone::pi_caladj[ , -c(1:2)][ ,"BE"]
x <- per_x13(myseries, template = "RSA5c")
x$run()
x$output$regarima$model$spec_rslt
# Model T.span Log transformation Mean Trading days
#1 RegARIMA - X13 from 1-2000 to 6-2019 FALSE FALSE 7
# Leap year Easter Outliers
#1 TRUE FALSE 2
In fact in the current version of JDemetra+ (and so in RJDemetra) you cannot just add the Leap Year without adding trading days. x$output$user_defined$preprocessing.model.lp
gives you NULL
if there is no Leap Year regressor. See the example below.
If you want to just add the Leap Year regressor you have to add it as an external regressor (but in this case x$output$user_defined$preprocessing.model.lp
will also return NULL
)
library(RJDemetra)
spec <- x13_spec("RSA0", tradingdays.leapyear="LeapYear", transform.adjust="None",
tradingdays.autoadjust=FALSE,tradingdays.test = "None")
x <- jx13(AirPassengers, spec)
get_indicators(x, "preprocessing.model.lp" )
#> $preprocessing.model.lp
#> NULL
spec2 <- x13_spec("RSA0",tradingdays.option = "TradingDays", tradingdays.leapyear="LeapYear", transform.adjust="None",
tradingdays.autoadjust=FALSE,tradingdays.test = "None")
x2 <- jx13(AirPassengers, spec2)
get_indicators(x2, "preprocessing.model.lp" )
#> $preprocessing.model.lp
#> [1] "Leap year:10,041[2,517]"
Created on 2020-04-08 by the reprex package (v0.3.0)
The information on the inclusion of a leap year effect in the quality report is not always correct. Leap year effect could be specified in the transform spec (transform.adjust="Lpyear") or alternatively in the regression spec. Maybe one the transform spec was not considered in this case.
Could you please post a working example of where you set the leap year with the transform spec?
The information on the inclusion of a leap year effect in the quality report is not always correct. Leap year effect could be specified in the transform spec (transform.adjust="Lpyear") or alternatively in the regression spec. Maybe one the transform spec was not considered in this case.