Closed LevonIpdjian closed 3 years ago
Hello,
Instead of x11.mode = "Multiplicative"
option, you should use transform.function = "Log"
.
Indeed, the first option only changes the decomposition mode used in the X11 algorithm. However, like it is said in the help associated to this parameter, it "could be changed by the program, if needed", that is to say when the decomposition used in the pre-adjustment (regarima) is not compatible and this is the case when the series is not log-transformed and you use the Multiplicative decomposition.
The second option changes the transformation used in the pre-adjustment and uses a compatible x11 decomposition:
library(RJDemetra)
set.seed(100)
N <- 15*12 #>48
Tendance <- 100:(100+(N-1))
Irregulier <- runif(N,0.8,1.2)
Saisonnalite <- seq(0.725,1.3,by=0.05)
BRUT <- ts(Tendance * Irregulier * Saisonnalite,start=c(2010,1),frequency=12)
BRUT_CRISE <- BRUT
BRUT_CRISE[48] <- BRUT_CRISE[48]/10 #Introduction d'une crise
SPEC <- x13_spec(x11.mode = "Multiplicative")
SPEC_AVEC_OUTLIER <- x13_spec(x11.mode = "Multiplicative" #) # Avec ou sans outliers, cela ne change pas le mode de décomposition choisi
,usrdef.outliersEnabled = T, usrdef.outliersType = "AO",
usrdef.outliersDate = "2013-12-01")
K <- RJDemetra::x13(BRUT,SPEC)
K_CRISE <- RJDemetra::x13(BRUT_CRISE,SPEC)
K_O_CRISE <- RJDemetra::x13(BRUT_CRISE,SPEC_AVEC_OUTLIER)
sprintf("Sans crise, sans outlier prédéfini : %s - Decomposition %s",
ifelse(K$regarima$model$spec_rslt["Log transformation"],"Log transformed","No transformation"),
K$decomposition$mode)
#> [1] "Sans crise, sans outlier prédéfini : Log transformed - Decomposition Multiplicative"
sprintf("Avec crise, sans outlier prédéfini : %s - Decomposition %s",
ifelse(K_CRISE$regarima$model$spec_rslt["Log transformation"],"Log transformed","No transformation"),
K_CRISE$decomposition$mode)
#> [1] "Avec crise, sans outlier prédéfini : No transformation - Decomposition Additive"
sprintf("Avec crise, avec outlier prédéfini : %s - Decomposition %s",
ifelse(K_O_CRISE$regarima$model$spec_rslt["Log transformation"],"Log transformed","No transformation"),
K_O_CRISE$decomposition$mode)
#> [1] "Avec crise, avec outlier prédéfini : Log transformed - Decomposition Multiplicative"
SPEC2 <- x13_spec(transform.function = "Log")
SPEC_AVEC_OUTLIER2 <- x13_spec(transform.function = "Log" #) # Avec ou sans outliers, cela ne change pas le mode de décomposition choisi
,usrdef.outliersEnabled = T, usrdef.outliersType = "AO",
usrdef.outliersDate = "2013-12-01")
K2 <- RJDemetra::x13(BRUT,SPEC2)
K_CRISE2 <- RJDemetra::x13(BRUT_CRISE,SPEC2)
K_O_CRISE2 <- RJDemetra::x13(BRUT_CRISE,SPEC_AVEC_OUTLIER2)
sprintf("Sans crise, sans outlier prédéfini : %s - Decomposition %s",
ifelse(K2$regarima$model$spec_rslt["Log transformation"],"Log transformed","No transformation"),
K2$decomposition$mode)
#> [1] "Sans crise, sans outlier prédéfini : Log transformed - Decomposition Multiplicative"
sprintf("Avec crise, sans outlier prédéfini : %s - Decomposition %s",
ifelse(K_CRISE2$regarima$model$spec_rslt["Log transformation"],"Log transformed","No transformation"),
K_CRISE2$decomposition$mode)
#> [1] "Avec crise, sans outlier prédéfini : Log transformed - Decomposition Multiplicative"
sprintf("Avec crise, avec outlier prédéfini : %s - Decomposition %s",
ifelse(K_O_CRISE2$regarima$model$spec_rslt["Log transformation"],"Log transformed","No transformation"),
K_O_CRISE2$decomposition$mode)
#> [1] "Avec crise, avec outlier prédéfini : Log transformed - Decomposition Multiplicative"
Created on 2021-08-02 by the reprex package (v2.0.0)
Thank you !
Hello,
I'm not sure this is an anomaly but I have an irritating issue about x11.mode. Sometimes when outliers are not prespecified, the decomposition mode is fixed to additive, even if I specified multiplicative manually. In fact, I can specifiy anything but PseudoAdditive, the applied decomposition will always be additive.
You can find below a reproductible example. In my console, the print sequences show "Multiplicative", "Additive", "Multiplicative" while all of them should be Multiplicative.