diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 00233a9..5b15306 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -23,7 +23,7 @@ jobs: - {os: windows-latest, r: 'release', java: 12, os-name: windows} - {os: windows-latest, r: 'devel', java: 12, os-name: windows} #- {os: windows-latest, r: 'oldrel', java: 12, os-name: windows} - - {os: macOS-latest, r: 'release', java: 12, os-name: macos} + - {os: macOS-latest, r: 'release', java: 13, os-name: macos} - {os: macOS-latest, r: 'devel', java: 17, os-name: macos} #- {os: macOS-latest, r: 'oldrel', java: 12, os-name: macos} - {os: windows-latest, r: 'devel', java: 17, os-name: windows} @@ -34,8 +34,9 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v4 with: + distribution: 'zulu' java-version: ${{ matrix.config.java }} - uses: r-lib/actions/setup-r@v2 diff --git a/DESCRIPTION b/DESCRIPTION index c9481a9..48f9fe6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: RJDemetra Type: Package Title: Interface to 'JDemetra+' Seasonal Adjustment Software -Version: 0.2.6 +Version: 0.2.7 Authors@R: c( person("Alain", "Quartier-la-Tente", role = c("aut", "cre"), email = "alain.quartier@yahoo.fr", @@ -31,7 +31,7 @@ LazyData: TRUE Suggests: knitr, rmarkdown -URL: https://jdemetra.github.io/rjdemetra/, https://github.com/jdemetra/rjdemetra -BugReports: https://github.com/jdemetra/rjdemetra/issues +URL: https://rjdverse.github.io/rjdemetra/, https://github.com/rjdverse/rjdemetra +BugReports: https://github.com/rjdverse/rjdemetra/issues Encoding: UTF-8 -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 diff --git a/NAMESPACE b/NAMESPACE index 8c0b0bb..8e72b7f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -107,6 +107,7 @@ export(regarima_tramoseats) export(regarima_x13) export(s_arima) export(s_arimaCoef) +export(s_benchmarking) export(s_easter) export(s_estimate) export(s_fcst) diff --git a/NEWS.md b/NEWS.md index 1fb5742..6922003 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,15 @@ +# RJDemetra 0.2.7 + +- URL to github repository updated (github.com/jdemetra replaced by github.com/rjdverse). + +- results of `user_defined_variables()` updated. + +- README correction. + +- benchmarking option added to `x13_spec()` and `tramoseats_spec()` and in output of `x13()` and `tramoseats()`. + +- .jars updated. + # RJDemetra 0.2.6 - possibility to export last msr for monthly data (issue #122). diff --git a/R/benchmarking_spec.R b/R/benchmarking_spec.R new file mode 100644 index 0000000..274554a --- /dev/null +++ b/R/benchmarking_spec.R @@ -0,0 +1,204 @@ +benchmarking_spec_def <- function(spec, + benchmarking.enabled = NA, + benchmarking.target = c(NA, "Original", "CalendarAdjusted"), + benchmarking.useforecast = NA, + benchmarking.rho = NA_real_, + benchmarking.lambda = NA_real_) + +{ + default_spec <- data.frame(benchmarking.enabled = FALSE, benchmarking.target = "CalendarAdjusted", + benchmarking.useforecast = FALSE, benchmarking.rho = 1, benchmarking.lambda = 1) + if(identical(spec, "X11")) { + benchmarking.mod <- rbind( + default_spec, + default_spec, + NA) + return(spec_benchmarking(benchmarking.mod)) + } + + benchmarking.target <- match.arg(benchmarking.target) + + + list.logical <- list("benchmarking.enabled", "benchmarking.useforecast") + list.numeric <- list("benchmarking.rho", "benchmarking.lambda") + + var.list <- list() + for (i in 1:length(list.logical)) { + eval(parse(text = paste("if( !is.logical(",list.logical[i],")) {", + list.logical[i], + " = NA; var.list=append(var.list,'", + list.logical[i], + "')}", + sep = ""))) + } + if (length(var.list) > 0) { + warning(paste("Variable(s)", + deparse(as.character(var.list)), + " should be logical. They are ignored."), + call. = FALSE) + } + + var.list <- list() + for (i in 1:length(list.numeric)) { + eval(parse(text = paste("if( !is.numeric(", + list.numeric[i], + ")) {", + list.numeric[i], + " = NA; var.list=append(var.list,'", + list.numeric[i], + "')}", + sep = ""))) + } + if (length(var.list) > 0) { + warning(paste("Variable(s)", + deparse(as.character(var.list)), + " should be numeric. They are ignored."), + call. = FALSE) + } + + benchmarking <- data.frame( + benchmarking.enabled = benchmarking.enabled, benchmarking.target = benchmarking.target, + benchmarking.useforecast = benchmarking.useforecast, benchmarking.rho = benchmarking.rho, + benchmarking.lambda = benchmarking.lambda) + benchmarking.mod <- rbind( + default_spec, + benchmarking, + NA) + return(spec_benchmarking(benchmarking.mod)) +} + +spec_benchmarking <- function(benchmarking){ + + for (i in c("benchmarking.enabled", "benchmarking.target", "benchmarking.useforecast", + "benchmarking.rho", "benchmarking.lambda")){ + benchmarking[3,i] <- if (!is.na(benchmarking[2,i])) {benchmarking[2,i]} else {benchmarking[1,i]} + } + if (!benchmarking[3,"benchmarking.enabled"]) { + benchmarking[3, "benchmarking.target"] <- "CalendarAdjusted" + benchmarking[3, "benchmarking.useforecast"] <- FALSE + benchmarking[3, "benchmarking.rho"] <- 1 + benchmarking[3, "benchmarking.lambda"] <- 1 + } + + rownames(benchmarking) <- c("Predefined","User_modif","Final") + class(benchmarking) <- c("benchmarking_spec", "data.frame") + return(benchmarking) +} + +benchmarking_spec<- function(spec, + benchmarking.enabled = NA, + benchmarking.target = c(NA, "Original", "CalendarAdjusted"), + benchmarking.useforecast = NA, + benchmarking.rho = NA_real_, + benchmarking.lambda = NA_real_) + +{ + benchmarking.target <- match.arg(benchmarking.target) + + list.logical <- list("benchmarking.enabled", "benchmarking.useforecast") + list.numeric <- list("benchmarking.rho", "benchmarking.lambda") + + var.list <- list() + for (i in 1:length(list.logical)) { + eval(parse(text = paste("if( !is.logical(",list.logical[i],")) {", + list.logical[i], + " = NA; var.list=append(var.list,'", + list.logical[i], + "')}", + sep = ""))) + } + if (length(var.list) > 0) { + warning(paste("Variable(s)", + deparse(as.character(var.list)), + " should be logical. They are ignored."), + call. = FALSE) + } + + var.list <- list() + for (i in 1:length(list.numeric)) { + eval(parse(text = paste("if( !is.numeric(", + list.numeric[i], + ")) {", + list.numeric[i], + " = NA; var.list=append(var.list,'", + list.numeric[i], + "')}", + sep = ""))) + } + if (length(var.list) > 0) { + warning(paste("Variable(s)", + deparse(as.character(var.list)), + " should be numeric. They are ignored."), + call. = FALSE) + } + + benchmarking <- data.frame( + benchmarking.enabled = benchmarking.enabled, benchmarking.target = benchmarking.target, + benchmarking.useforecast = benchmarking.useforecast, benchmarking.rho = benchmarking.rho, + benchmarking.lambda = benchmarking.lambda) + benchmarking.spec <- s_benchmarking(spec) + benchmarking.mod <- rbind(benchmarking.spec, benchmarking, NA) + return(spec_benchmarking(benchmarking.mod)) +} + + +spec_benchmarking_r2jd <- function(rspec = NA, jdspec = NA){ + benchmarking <- s_benchmarking(rspec) + jbench <- .jcall(jdspec,"Ljdr/spec/sa/SaBenchmarkingSpec;","getBenchmarking") + + .jcall(jbench, "V", "setEnabled", benchmarking[["benchmarking.enabled"]]) + if (benchmarking[["benchmarking.enabled"]]) { + .jcall(jbench, "V", "setTarget", benchmarking[["benchmarking.target"]]) + .jcall(jbench, "V", "setUseForecast", benchmarking[["benchmarking.useforecast"]]) + .jcall(jbench, "V", "setRho", benchmarking[["benchmarking.rho"]]) + .jcall(jbench, "V", "setLambda", benchmarking[["benchmarking.lambda"]]) + } + + return(jbench) +} + +spec_benchmarking_jd2r <- function(jrobj){ + jbench <- .jcall(jrobj, "Ljdr/spec/sa/SaBenchmarkingSpec;", "getBenchmarking") + benchmarking.target <- .jcall(jbench, "Ljava/lang/String;", "getTarget") + benchmarking.enabled <- .jcall(jbench, "Z", "isEnabled") + benchmarking.useforecast <- .jcall(jbench, "Z", "isUseForecast") + benchmarking.rho <- .jcall(jbench, "D", "getRho") + benchmarking.lambda <- .jcall(jbench, "D", "getLambda") + + data.frame( + benchmarking.enabled = benchmarking.enabled, benchmarking.target = benchmarking.target, + benchmarking.useforecast = benchmarking.useforecast, benchmarking.rho = benchmarking.rho, + benchmarking.lambda = benchmarking.lambda) +} + +benchmarking <- function(jrobj,spec){ + specification <- spec[3,] + rownames(specification) <- "" + if(specification[["benchmarking.enabled"]]) { + original <- result(jrobj, "benchmarking.original") + result <- result(jrobj, "benchmarking.result") + Differences <- original - result + bench_res <- ts.union(original, result, Differences) + } else { + bench_res <- NULL + } + z <- list(specification = specification, benchmarking = bench_res) + class(z) <- c("benchmarking") + return(z) +} + +benchmarking_def <- function(jrobj,jspec){ + specification <- spec_benchmarking_jd2r(jspec) + rownames(specification) <- "" + if(specification[["benchmarking.enabled"]]) { + original <- result(jrobj, "benchmarking.original") + result <- result(jrobj, "benchmarking.result") + Differences <- original - result + bench_res <- ts.union(original, result, Differences) + } else { + bench_res <- NULL + } + z <- list(specification = specification, benchmarking = bench_res) + class(z) <- c("benchmarking") + return(z) +} diff --git a/R/get_jspec.R b/R/get_jspec.R index 8e5ce67..1403672 100644 --- a/R/get_jspec.R +++ b/R/get_jspec.R @@ -15,8 +15,9 @@ get_jspec.X13 <- function(x, ...){ } else { jrspec <- .jcall("jdr/spec/x13/X13Spec", "Ljdr/spec/x13/X13Spec;", "of", "RSA0") } - jdictionary <- spec_regarima_X13_r2jd(spec,jrspec) - seasma <- specX11_r2jd(spec,jrspec, freq = frequency(x$final$series)) + spec_regarima_X13_r2jd(spec,jrspec) + specX11_r2jd(spec,jrspec, freq = frequency(x$final$series)) + spec_benchmarking_r2jd(spec, jrspec) jspec <- .jcall(jrspec, "Lec/satoolkit/x13/X13Specification;", "getCore") jspec } @@ -24,8 +25,9 @@ get_jspec.X13 <- function(x, ...){ get_jspec.TRAMO_SEATS <- function(x, ...){ spec <- tramoseats_spec(x, ...) jrspec <- .jcall("jdr/spec/tramoseats/TramoSeatsSpec", "Ljdr/spec/tramoseats/TramoSeatsSpec;", "of", "RSA0") - jdictionary <- spec_TRAMO_r2jd(spec,jrspec) - spec_seats <- specSeats_r2jd(spec,jrspec) + spec_TRAMO_r2jd(spec,jrspec) + specSeats_r2jd(spec,jrspec) + spec_benchmarking_r2jd(spec, jrspec) jspec <- .jcall(jrspec, "Lec/satoolkit/tramoseats/TramoSeatsSpecification;", "getCore") jspec } diff --git a/R/init.R b/R/init.R index 9ddea8d..9c4059c 100644 --- a/R/init.R +++ b/R/init.R @@ -229,7 +229,7 @@ rjdemetra_java <- new.env(parent = emptyenv()) rjdemetra_java$clobject <- NULL check_valid_java_version <- function(){ - # Check Java version >= 8 and <= 15 + # Check Java version >= 8 jv <- rJava::.jcall("java/lang/System", "S", "getProperty", "java.version") if(jv < "1.8.0") return (FALSE) diff --git a/R/jtramoseats.R b/R/jtramoseats.R index 12692c5..6c049a0 100644 --- a/R/jtramoseats.R +++ b/R/jtramoseats.R @@ -18,6 +18,7 @@ jtramoseats.SA_spec <- function(series, spec, jrspec <- .jcall("jdr/spec/tramoseats/TramoSeatsSpec", "Ljdr/spec/tramoseats/TramoSeatsSpec;", "of", "RSA0") jdictionary <- spec_TRAMO_r2jd(spec,jrspec) specSeats_r2jd(spec,jrspec) + spec_benchmarking_r2jd(rspec = spec, jdspec = jrspec) jspec <- .jcall(jrspec, "Lec/satoolkit/tramoseats/TramoSeatsSpecification;", "getCore") jrslt <- .jcall("ec/tstoolkit/jdr/sa/Processor", "Lec/tstoolkit/jdr/sa/TramoSeatsResults;", "tramoseats", ts_r2jd(series), jspec, jdictionary ) jrslt <- new (Class = "TramoSeats_java", internal = jrslt) diff --git a/R/jx13.R b/R/jx13.R index e84fa68..ecee254 100644 --- a/R/jx13.R +++ b/R/jx13.R @@ -22,6 +22,7 @@ jx13.SA_spec <- function(series, spec, userdefined = NULL){ } jdictionary <- spec_regarima_X13_r2jd(spec, jrspec) seasma <- specX11_r2jd(spec, jrspec, freq = frequency(series)) + spec_benchmarking_r2jd(rspec = spec, jdspec = jrspec) jspec <- .jcall(jrspec, "Lec/satoolkit/x13/X13Specification;", "getCore") jrslt <- .jcall("ec/tstoolkit/jdr/sa/Processor", "Lec/tstoolkit/jdr/sa/X13Results;", "x13", ts_r2jd(series), jspec, jdictionary) jrslt <- new(Class = "X13_java", internal = jrslt) diff --git a/R/saveSpec.R b/R/saveSpec.R index b8c4e8f..4703e22 100644 --- a/R/saveSpec.R +++ b/R/saveSpec.R @@ -103,22 +103,24 @@ save_spec = function (object, file = file.path(tempdir(), "spec.RData")) { if (inherits(object,c("SA","SA_spec")) & inherits(object,"X13")){ decomp <- s_x11(object) + benchmarking <- s_benchmarking(object) cspec <- "SA_saveX13" } else if (inherits(object,c("SA","SA_spec")) & inherits(object,"TRAMO_SEATS")){ decomp <- s_seats(object) + benchmarking <- s_benchmarking(object) cspec <- "SA_saveTS" } else if (inherits(object,"X13")) { - decomp <- NA + decomp <- benchmarking <- NA cspec <- "regarima_saveX13" } else { - decomp <- NA + decomp <- benchmarking <- NA cspec <- "regarima_saveTS" } spec <- list(estimate=estimate, transform=transform, usrdef = usrdef,predef.outliers=predef.outliers, predef.variables=predef.variables, trading.days=trading.days,easter= easter, outliers=outliers, arima.dsc=arima.dsc, predef.coef=predef.coef, - forecast = forecast,span=span, decomp=decomp) + forecast = forecast,span=span, decomp=decomp, benchmarking = benchmarking) class(spec) <- cspec save(spec, file = file) } @@ -144,6 +146,7 @@ load_spec <- function (file = "spec.RData") { s.forecast <- object$forecast span <- object$span s.decomp <- object$decomp + s.benchmarking <- object$benchmarking estimate<- rbind(s.estimate,rep(NA,length(s.estimate)),s.estimate) transform <- rbind(s.transform,rep(NA,length(s.transform)),s.transform) @@ -153,15 +156,20 @@ load_spec <- function (file = "spec.RData") { outliers <- rbind(s.outliers,rep(NA,length(s.outliers)),s.outliers) arima.dsc <- rbind(s.arima.dsc,rep(NA,length(s.arima.dsc)),s.arima.dsc) forecast <- rbind(s.forecast,rep(NA,length(s.forecast)),s.forecast) - - rownames(estimate)=c("Loaded","User_modif","Final") - rownames(transform)=c("Loaded","User_modif","Final") - rownames(usrdef)=c("Loaded","User_modif","Final") - rownames(trading.days)=c("Loaded","User_modif","Final") - rownames(easter)=c("Loaded","User_modif","Final") - rownames(outliers)=c("Loaded","User_modif","Final") - rownames(arima.dsc)=c("Loaded","User_modif","Final") - rownames(forecast)=c("Loaded","User_modif","Final") + benchmarking <- rbind(s.benchmarking,NA,s.benchmarking) + class(benchmarking) <- c("benchmarking_spec", "data.frame") + decomp <- rbind(s.decomp,rep(NA,length(s.decomp )),s.decomp) + rownames(estimate) <- + rownames(transform) <- + rownames(usrdef) <- + rownames(trading.days) <- + rownames(easter) <- + rownames(outliers) <- + rownames(arima.dsc) <- + rownames(forecast) <- + rownames(benchmarking) <- + rownames(decomp) <- + c("Loaded","User_modif","Final") userdef <-list(specification = usrdef, outliers = list(Predefined = s.predef.outliers, Final = s.predef.outliers), variables = list(Predefined = s.predef.variables, Final = s.predef.variables)) @@ -179,18 +187,16 @@ load_spec <- function (file = "spec.RData") { return(regarima) } else if (inherits(object,"SA_saveX13")){ class(regarima) <- c("regarima_spec","X13") - x11 <- rbind(s.decomp,rep(NA,length(s.decomp )),s.decomp) - rownames(x11)=c("Loaded","User_modif","Final") + x11 <- decomp class(x11) <- c("X11_spec","data.frame") - z <- list(regarima = regarima, x11 = x11) + z <- list(regarima = regarima, x11 = x11, benchmarking = benchmarking) class(z) <- c("SA_spec","X13") return(z) } else { class(regarima) <- c("regarima_spec","TRAMO_SEATS") - seats <- rbind(s.decomp,rep(NA,length(s.decomp )),s.decomp) - rownames(seats)=c("Loaded","User_modif","Final") + seats <- decomp class(seats) <- c("seats_spec","data.frame") - z <- list(regarima = regarima, seats = seats) + z <- list(regarima = regarima, seats = seats, benchmarking = benchmarking) class(z) <- c("SA_spec","TRAMO_SEATS") return(z) } diff --git a/R/spec.R b/R/spec.R index 6d6eb27..381a2d9 100644 --- a/R/spec.R +++ b/R/spec.R @@ -476,6 +476,21 @@ s_x11 <- function(object = NA){ #' @rdname specification #' @name specification #' @export +s_benchmarking <- function(object = NA){ + if (inherits(object, c("SA","SA_spec"))==FALSE) + stop("This function must only be used with \"SA\" and \"SA_spec\" objects", call. = FALSE) + + if (inherits(object, "SA")){ + return(object$benchmarking$specification) + } else { + obj <- object$benchmarking[3,] + rownames(obj) <- "" + return(obj) + } +} +#' @rdname specification +#' @name specification +#' @export s_seats <- function(object = NA){ if (inherits(object, c("SA","SA_spec"))==FALSE) stop("This function must only be used with \"SA\" and \"SA_spec\" objects", call. = FALSE) diff --git a/R/tramoseats.R b/R/tramoseats.R index 68bef00..68651db 100644 --- a/R/tramoseats.R +++ b/R/tramoseats.R @@ -164,11 +164,12 @@ tramoseats.SA_spec <- function(series, spec, } reg <- regarima_TS(jrobj = jrobct_arima, spec = spec$regarima) deco <- decomp_TS(jrobj = jrobct, spec = spec$seats) + bench <- benchmarking(jrobj = jrobct, spec = spec$benchmarking) fin <- final(jrobj = jrobct) diagn <- diagnostics(jrobj = jrobct) z <- list(regarima = reg, decomposition = deco, final = fin, - diagnostics = diagn, + diagnostics = diagn, benchmarking = bench, user_defined = user_defined(userdefined, jrobct)) class(z) <- c("SA","TRAMO_SEATS") @@ -215,11 +216,12 @@ tramoseatsJavaResults <- function(jrslt, spec, extra_info = extra_info, freq = freq) deco <- decomp_defTS(jrobj = jrobct, spec = spec) + bench <- benchmarking_def(jrobj = jrobct, spec) fin <- final(jrobj = jrobct) diagn <- diagnostics(jrobj = jrobct) z <- list(regarima = reg, decomposition = deco, final = fin, - diagnostics = diagn, + diagnostics = diagn, benchmarking = bench, user_defined = user_defined(userdefined, jrobct)) class(z) <- c("SA","TRAMO_SEATS") diff --git a/R/tramoseats_spec.R b/R/tramoseats_spec.R index 0b1fa4c..02c7155 100644 --- a/R/tramoseats_spec.R +++ b/R/tramoseats_spec.R @@ -11,6 +11,7 @@ #' The default is \code{"RSAfull"}. #' #' @inheritParams regarima_spec_tramoseats +#' @inheritParams x13_spec #' @param seats.predictionLength integer: the number of forecasts used in the decomposition. Negative values correspond to number of years. Default=-1. #' #' @param seats.approx character: the approximation mode. When the ARIMA model estimated by TRAMO does not accept an admissible decomposition, SEATS: \code{"None"} - performs an approximation; \code{"Legacy"} - replaces the model with a decomposable one; \code{"Noisy"} - estimates a new model by adding a white noise to the non-admissible model estimated by TRAMO. Default="Legacy". @@ -142,200 +143,221 @@ #' s_arimaCoef(mysa8) #' } #' @export -tramoseats_spec <- function(spec = c("RSAfull", "RSA0", "RSA1", "RSA2", "RSA3", "RSA4", "RSA5"), - preliminary.check = NA, - estimate.from = NA_character_, - estimate.to = NA_character_, - estimate.first = NA_integer_, - estimate.last = NA_integer_, - estimate.exclFirst = NA_integer_, - estimate.exclLast = NA_integer_, - estimate.tol = NA_integer_, - estimate.eml = NA, - estimate.urfinal = NA_integer_, - transform.function = c(NA, "Auto", "None", "Log"), - transform.fct = NA_integer_, - usrdef.outliersEnabled = NA, - usrdef.outliersType = NA, - usrdef.outliersDate = NA, - usrdef.outliersCoef = NA, - usrdef.varEnabled = NA, - usrdef.var = NA, - usrdef.varType = NA, - usrdef.varCoef = NA, - tradingdays.mauto = c(NA, "Unused", "FTest", "WaldTest"), - tradingdays.pftd = NA_integer_, - tradingdays.option = c(NA, "TradingDays", "WorkingDays", "UserDefined", "None"), - tradingdays.leapyear = NA, - tradingdays.stocktd = NA_integer_, - tradingdays.test = c(NA, "Separate_T", "Joint_F", "None"), - easter.type = c(NA, "Unused", "Standard", "IncludeEaster", "IncludeEasterMonday"), - easter.julian = NA, - easter.duration = NA_integer_, - easter.test = NA, - outlier.enabled = NA, - outlier.from = NA_character_, - outlier.to = NA_character_, - outlier.first = NA_integer_, - outlier.last = NA_integer_, - outlier.exclFirst = NA_integer_, - outlier.exclLast = NA_integer_, - outlier.ao = NA, - outlier.tc = NA, - outlier.ls = NA, - outlier.so = NA, - outlier.usedefcv = NA, - outlier.cv = NA_integer_, - outlier.eml = NA, - outlier.tcrate = NA_integer_, - automdl.enabled = NA, - automdl.acceptdefault = NA, - automdl.cancel = NA_integer_, - automdl.ub1 = NA_integer_, - automdl.ub2 = NA_integer_, - automdl.armalimit = NA_integer_, - automdl.reducecv = NA_integer_, - automdl.ljungboxlimit = NA_integer_, - automdl.compare = NA, - arima.mu = NA, - arima.p = NA_integer_, - arima.d = NA_integer_, - arima.q = NA_integer_, - arima.bp = NA_integer_, - arima.bd = NA_integer_, - arima.bq = NA_integer_, - arima.coefEnabled = NA, - arima.coef= NA, - arima.coefType = NA, - fcst.horizon = NA_integer_, - seats.predictionLength = NA_integer_, - seats.approx = c(NA, "None", "Legacy", "Noisy"), - seats.trendBoundary = NA_integer_, - seats.seasdBoundary = NA_integer_, - seats.seasdBoundary1 = NA_integer_, - seats.seasTol = NA_integer_, - seats.maBoundary = NA_integer_, - seats.method = c(NA, "Burman", "KalmanSmoother", "McElroyMatrix") +tramoseats_spec <- function( + spec = c("RSAfull", "RSA0", "RSA1", "RSA2", "RSA3", "RSA4", "RSA5"), + preliminary.check = NA, + estimate.from = NA_character_, + estimate.to = NA_character_, + estimate.first = NA_integer_, + estimate.last = NA_integer_, + estimate.exclFirst = NA_integer_, + estimate.exclLast = NA_integer_, + estimate.tol = NA_integer_, + estimate.eml = NA, + estimate.urfinal = NA_integer_, + transform.function = c(NA, "Auto", "None", "Log"), + transform.fct = NA_integer_, + usrdef.outliersEnabled = NA, + usrdef.outliersType = NA, + usrdef.outliersDate = NA, + usrdef.outliersCoef = NA, + usrdef.varEnabled = NA, + usrdef.var = NA, + usrdef.varType = NA, + usrdef.varCoef = NA, + tradingdays.mauto = c(NA, "Unused", "FTest", "WaldTest"), + tradingdays.pftd = NA_integer_, + tradingdays.option = c(NA, "TradingDays", "WorkingDays", "UserDefined", "None"), + tradingdays.leapyear = NA, + tradingdays.stocktd = NA_integer_, + tradingdays.test = c(NA, "Separate_T", "Joint_F", "None"), + easter.type = c(NA, "Unused", "Standard", "IncludeEaster", "IncludeEasterMonday"), + easter.julian = NA, + easter.duration = NA_integer_, + easter.test = NA, + outlier.enabled = NA, + outlier.from = NA_character_, + outlier.to = NA_character_, + outlier.first = NA_integer_, + outlier.last = NA_integer_, + outlier.exclFirst = NA_integer_, + outlier.exclLast = NA_integer_, + outlier.ao = NA, + outlier.tc = NA, + outlier.ls = NA, + outlier.so = NA, + outlier.usedefcv = NA, + outlier.cv = NA_integer_, + outlier.eml = NA, + outlier.tcrate = NA_integer_, + automdl.enabled = NA, + automdl.acceptdefault = NA, + automdl.cancel = NA_integer_, + automdl.ub1 = NA_integer_, + automdl.ub2 = NA_integer_, + automdl.armalimit = NA_integer_, + automdl.reducecv = NA_integer_, + automdl.ljungboxlimit = NA_integer_, + automdl.compare = NA, + arima.mu = NA, + arima.p = NA_integer_, + arima.d = NA_integer_, + arima.q = NA_integer_, + arima.bp = NA_integer_, + arima.bd = NA_integer_, + arima.bq = NA_integer_, + arima.coefEnabled = NA, + arima.coef= NA, + arima.coefType = NA, + fcst.horizon = NA_integer_, + seats.predictionLength = NA_integer_, + seats.approx = c(NA, "None", "Legacy", "Noisy"), + seats.trendBoundary = NA_integer_, + seats.seasdBoundary = NA_integer_, + seats.seasdBoundary1 = NA_integer_, + seats.seasTol = NA_integer_, + seats.maBoundary = NA_integer_, + seats.method = c(NA, "Burman", "KalmanSmoother", "McElroyMatrix"), + benchmarking.enabled = NA, + benchmarking.target = c(NA, "Original", "CalendarAdjusted"), + benchmarking.useforecast = NA, + benchmarking.rho = NA_real_, + benchmarking.lambda = NA_real_ ){ UseMethod("tramoseats_spec", spec) } #' @export -tramoseats_spec.character <- function(spec = c("RSAfull", "RSA0", "RSA1", "RSA2", "RSA3", "RSA4", "RSA5"), - preliminary.check = NA, - estimate.from = NA_character_, - estimate.to = NA_character_, - estimate.first = NA_integer_, - estimate.last = NA_integer_, - estimate.exclFirst = NA_integer_, - estimate.exclLast = NA_integer_, - estimate.tol = NA_integer_, - estimate.eml = NA, - estimate.urfinal = NA_integer_, - transform.function = c(NA, "Auto", "None", "Log"), - transform.fct = NA_integer_, - usrdef.outliersEnabled = NA, - usrdef.outliersType = NA, - usrdef.outliersDate = NA, - usrdef.outliersCoef = NA, - usrdef.varEnabled = NA, - usrdef.var = NA, - usrdef.varType = NA, - usrdef.varCoef = NA, - tradingdays.mauto = c(NA, "Unused", "FTest", "WaldTest"), - tradingdays.pftd = NA_integer_, - tradingdays.option = c(NA, "TradingDays", "WorkingDays", "UserDefined", "None"), - tradingdays.leapyear = NA, - tradingdays.stocktd = NA_integer_, - tradingdays.test = c(NA, "Separate_T", "Joint_F", "None"), - easter.type = c(NA, "Unused", "Standard", "IncludeEaster", "IncludeEasterMonday"), - easter.julian = NA, - easter.duration = NA_integer_, - easter.test = NA, - outlier.enabled = NA, - outlier.from = NA_character_, - outlier.to = NA_character_, - outlier.first = NA_integer_, - outlier.last = NA_integer_, - outlier.exclFirst = NA_integer_, - outlier.exclLast = NA_integer_, - outlier.ao = NA, - outlier.tc = NA, - outlier.ls = NA, - outlier.so = NA, - outlier.usedefcv = NA, - outlier.cv = NA_integer_, - outlier.eml = NA, - outlier.tcrate = NA_integer_, - automdl.enabled = NA, - automdl.acceptdefault = NA, - automdl.cancel = NA_integer_, - automdl.ub1 = NA_integer_, - automdl.ub2 = NA_integer_, - automdl.armalimit = NA_integer_, - automdl.reducecv = NA_integer_, - automdl.ljungboxlimit = NA_integer_, - automdl.compare = NA, - arima.mu = NA, - arima.p = NA_integer_, - arima.d = NA_integer_, - arima.q = NA_integer_, - arima.bp = NA_integer_, - arima.bd = NA_integer_, - arima.bq = NA_integer_, - arima.coefEnabled = NA, - arima.coef= NA, - arima.coefType = NA, - fcst.horizon = NA_integer_, - seats.predictionLength = NA_integer_, - seats.approx = c(NA, "None", "Legacy", "Noisy"), - seats.trendBoundary = NA_integer_, - seats.seasdBoundary = NA_integer_, - seats.seasdBoundary1 = NA_integer_, - seats.seasTol = NA_integer_, - seats.maBoundary = NA_integer_, - seats.method = c(NA, "Burman", "KalmanSmoother", "McElroyMatrix")) +tramoseats_spec.character <- function( + spec = c("RSAfull", "RSA0", "RSA1", "RSA2", "RSA3", "RSA4", "RSA5"), + preliminary.check = NA, + estimate.from = NA_character_, + estimate.to = NA_character_, + estimate.first = NA_integer_, + estimate.last = NA_integer_, + estimate.exclFirst = NA_integer_, + estimate.exclLast = NA_integer_, + estimate.tol = NA_integer_, + estimate.eml = NA, + estimate.urfinal = NA_integer_, + transform.function = c(NA, "Auto", "None", "Log"), + transform.fct = NA_integer_, + usrdef.outliersEnabled = NA, + usrdef.outliersType = NA, + usrdef.outliersDate = NA, + usrdef.outliersCoef = NA, + usrdef.varEnabled = NA, + usrdef.var = NA, + usrdef.varType = NA, + usrdef.varCoef = NA, + tradingdays.mauto = c(NA, "Unused", "FTest", "WaldTest"), + tradingdays.pftd = NA_integer_, + tradingdays.option = c(NA, "TradingDays", "WorkingDays", "UserDefined", "None"), + tradingdays.leapyear = NA, + tradingdays.stocktd = NA_integer_, + tradingdays.test = c(NA, "Separate_T", "Joint_F", "None"), + easter.type = c(NA, "Unused", "Standard", "IncludeEaster", "IncludeEasterMonday"), + easter.julian = NA, + easter.duration = NA_integer_, + easter.test = NA, + outlier.enabled = NA, + outlier.from = NA_character_, + outlier.to = NA_character_, + outlier.first = NA_integer_, + outlier.last = NA_integer_, + outlier.exclFirst = NA_integer_, + outlier.exclLast = NA_integer_, + outlier.ao = NA, + outlier.tc = NA, + outlier.ls = NA, + outlier.so = NA, + outlier.usedefcv = NA, + outlier.cv = NA_integer_, + outlier.eml = NA, + outlier.tcrate = NA_integer_, + automdl.enabled = NA, + automdl.acceptdefault = NA, + automdl.cancel = NA_integer_, + automdl.ub1 = NA_integer_, + automdl.ub2 = NA_integer_, + automdl.armalimit = NA_integer_, + automdl.reducecv = NA_integer_, + automdl.ljungboxlimit = NA_integer_, + automdl.compare = NA, + arima.mu = NA, + arima.p = NA_integer_, + arima.d = NA_integer_, + arima.q = NA_integer_, + arima.bp = NA_integer_, + arima.bd = NA_integer_, + arima.bq = NA_integer_, + arima.coefEnabled = NA, + arima.coef= NA, + arima.coefType = NA, + fcst.horizon = NA_integer_, + seats.predictionLength = NA_integer_, + seats.approx = c(NA, "None", "Legacy", "Noisy"), + seats.trendBoundary = NA_integer_, + seats.seasdBoundary = NA_integer_, + seats.seasdBoundary1 = NA_integer_, + seats.seasTol = NA_integer_, + seats.maBoundary = NA_integer_, + seats.method = c(NA, "Burman", "KalmanSmoother", "McElroyMatrix"), + benchmarking.enabled = NA, + benchmarking.target = c(NA, "Original", "CalendarAdjusted"), + benchmarking.useforecast = NA, + benchmarking.rho = NA_real_, + benchmarking.lambda = NA_real_) { spec <- match.arg(spec) reg_spec <- gsub("RSA", "TR", spec) - regarima <- regarima_spec_tramoseats(spec = reg_spec, preliminary.check = preliminary.check, - estimate.from = estimate.from, estimate.to = estimate.to, - estimate.first = estimate.first, estimate.last = estimate.last, - estimate.exclFirst = estimate.exclFirst, estimate.exclLast = estimate.exclLast, - estimate.tol = estimate.tol, estimate.eml = estimate.eml, - estimate.urfinal = estimate.urfinal, transform.function = transform.function, - transform.fct = transform.fct, usrdef.outliersEnabled = usrdef.outliersEnabled, - usrdef.outliersType = usrdef.outliersType, usrdef.outliersDate = usrdef.outliersDate, - usrdef.outliersCoef = usrdef.outliersCoef, usrdef.varEnabled = usrdef.varEnabled, - usrdef.var = usrdef.var, usrdef.varType = usrdef.varType, - usrdef.varCoef = usrdef.varCoef, tradingdays.mauto = tradingdays.mauto, - tradingdays.pftd = tradingdays.pftd, tradingdays.option = tradingdays.option, - tradingdays.leapyear = tradingdays.leapyear, tradingdays.stocktd = tradingdays.stocktd, - tradingdays.test = tradingdays.test, easter.type = easter.type, - easter.julian = easter.julian, easter.duration = easter.duration, - easter.test = easter.test, outlier.enabled = outlier.enabled, - outlier.from = outlier.from, outlier.to = outlier.to, outlier.first = outlier.first, - outlier.last = outlier.last, outlier.exclFirst = outlier.exclFirst, - outlier.exclLast = outlier.exclLast, outlier.ao = outlier.ao, - outlier.tc = outlier.tc, outlier.ls = outlier.ls, outlier.so = outlier.so, - outlier.usedefcv = outlier.usedefcv, outlier.cv = outlier.cv, - outlier.eml = outlier.eml, outlier.tcrate = outlier.tcrate, - automdl.enabled = automdl.enabled, automdl.acceptdefault = automdl.acceptdefault, - automdl.cancel = automdl.cancel, automdl.ub1 = automdl.ub1, - automdl.ub2 = automdl.ub2, automdl.armalimit = automdl.armalimit, - automdl.reducecv = automdl.reducecv, automdl.ljungboxlimit = automdl.ljungboxlimit, - automdl.compare = automdl.compare, arima.mu = arima.mu, arima.p = arima.p, - arima.d = arima.d, arima.q = arima.q, arima.bp = arima.bp, - arima.bd = arima.bd, arima.bq = arima.bq, arima.coefEnabled = arima.coefEnabled, - arima.coef = arima.coef, arima.coefType = arima.coefType, - fcst.horizon = fcst.horizon) + regarima <- regarima_spec_tramoseats( + spec = reg_spec, preliminary.check = preliminary.check, + estimate.from = estimate.from, estimate.to = estimate.to, + estimate.first = estimate.first, estimate.last = estimate.last, + estimate.exclFirst = estimate.exclFirst, estimate.exclLast = estimate.exclLast, + estimate.tol = estimate.tol, estimate.eml = estimate.eml, + estimate.urfinal = estimate.urfinal, transform.function = transform.function, + transform.fct = transform.fct, usrdef.outliersEnabled = usrdef.outliersEnabled, + usrdef.outliersType = usrdef.outliersType, usrdef.outliersDate = usrdef.outliersDate, + usrdef.outliersCoef = usrdef.outliersCoef, usrdef.varEnabled = usrdef.varEnabled, + usrdef.var = usrdef.var, usrdef.varType = usrdef.varType, + usrdef.varCoef = usrdef.varCoef, tradingdays.mauto = tradingdays.mauto, + tradingdays.pftd = tradingdays.pftd, tradingdays.option = tradingdays.option, + tradingdays.leapyear = tradingdays.leapyear, tradingdays.stocktd = tradingdays.stocktd, + tradingdays.test = tradingdays.test, easter.type = easter.type, + easter.julian = easter.julian, easter.duration = easter.duration, + easter.test = easter.test, outlier.enabled = outlier.enabled, + outlier.from = outlier.from, outlier.to = outlier.to, outlier.first = outlier.first, + outlier.last = outlier.last, outlier.exclFirst = outlier.exclFirst, + outlier.exclLast = outlier.exclLast, outlier.ao = outlier.ao, + outlier.tc = outlier.tc, outlier.ls = outlier.ls, outlier.so = outlier.so, + outlier.usedefcv = outlier.usedefcv, outlier.cv = outlier.cv, + outlier.eml = outlier.eml, outlier.tcrate = outlier.tcrate, + automdl.enabled = automdl.enabled, automdl.acceptdefault = automdl.acceptdefault, + automdl.cancel = automdl.cancel, automdl.ub1 = automdl.ub1, + automdl.ub2 = automdl.ub2, automdl.armalimit = automdl.armalimit, + automdl.reducecv = automdl.reducecv, automdl.ljungboxlimit = automdl.ljungboxlimit, + automdl.compare = automdl.compare, arima.mu = arima.mu, arima.p = arima.p, + arima.d = arima.d, arima.q = arima.q, arima.bp = arima.bp, + arima.bd = arima.bd, arima.bq = arima.bq, arima.coefEnabled = arima.coefEnabled, + arima.coef = arima.coef, arima.coefType = arima.coefType, + fcst.horizon = fcst.horizon) - seats <- seats_spec_def(spec = spec, seats.predictionLength = seats.predictionLength, - seats.approx = seats.approx, seats.trendBoundary = seats.trendBoundary, - seats.seasdBoundary = seats.seasdBoundary, seats.seasdBoundary1 = seats.seasdBoundary1, - seats.seasTol = seats.seasTol, seats.maBoundary = seats.maBoundary, - seats.method = seats.method) + seats <- seats_spec_def( + spec = spec, seats.predictionLength = seats.predictionLength, + seats.approx = seats.approx, seats.trendBoundary = seats.trendBoundary, + seats.seasdBoundary = seats.seasdBoundary, seats.seasdBoundary1 = seats.seasdBoundary1, + seats.seasTol = seats.seasTol, seats.maBoundary = seats.maBoundary, + seats.method = seats.method) + benchmarking <- benchmarking_spec_def( + spec = spec, + benchmarking.enabled = benchmarking.enabled, + benchmarking.target = benchmarking.target, + benchmarking.useforecast = benchmarking.useforecast, + benchmarking.rho = benchmarking.rho, + benchmarking.lambda = benchmarking.lambda) - z <- list(regarima = regarima, seats = seats) + z <- list(regarima = regarima, seats = seats, benchmarking = benchmarking) class(z) <- c("SA_spec","TRAMO_SEATS") return(z) } @@ -451,50 +473,62 @@ tramoseats_spec.TRAMO_SEATS <- function(spec, seats.seasdBoundary1 = NA_integer_, seats.seasTol = NA_integer_, seats.maBoundary = NA_integer_, - seats.method = c(NA, "Burman", "KalmanSmoother", "McElroyMatrix")) + seats.method = c(NA, "Burman", "KalmanSmoother", "McElroyMatrix"), + benchmarking.enabled = NA, + benchmarking.target = c(NA, "Original", "CalendarAdjusted"), + benchmarking.useforecast = NA, + benchmarking.rho = NA_real_, + benchmarking.lambda = NA_real_) { if ( !inherits(spec, c("SA","SA_spec"))) stop("The function must only be used with c(\"SA\",\"TRAMO_SEATS\") and c(\"SA_spec\",\"TRAMO_SEATS\") objects", call. = FALSE) - regarima <- regarima_spec_tramoseats(spec = spec, preliminary.check = preliminary.check, - estimate.from = estimate.from, estimate.to = estimate.to, - estimate.first = estimate.first, estimate.last = estimate.last, - estimate.exclFirst = estimate.exclFirst, estimate.exclLast = estimate.exclLast, - estimate.tol = estimate.tol, estimate.eml = estimate.eml, - estimate.urfinal = estimate.urfinal, transform.function = transform.function, - transform.fct = transform.fct, usrdef.outliersEnabled = usrdef.outliersEnabled, - usrdef.outliersType = usrdef.outliersType, usrdef.outliersDate = usrdef.outliersDate, - usrdef.outliersCoef = usrdef.outliersCoef, usrdef.varEnabled = usrdef.varEnabled, - usrdef.var = usrdef.var, usrdef.varType = usrdef.varType, - usrdef.varCoef = usrdef.varCoef, tradingdays.mauto = tradingdays.mauto, - tradingdays.pftd = tradingdays.pftd, tradingdays.option = tradingdays.option, - tradingdays.leapyear = tradingdays.leapyear, tradingdays.stocktd = tradingdays.stocktd, - tradingdays.test = tradingdays.test, easter.type = easter.type, - easter.julian = easter.julian, easter.duration = easter.duration, - easter.test = easter.test, outlier.enabled = outlier.enabled, - outlier.from = outlier.from, outlier.to = outlier.to, outlier.first = outlier.first, - outlier.last = outlier.last, outlier.exclFirst = outlier.exclFirst, - outlier.exclLast = outlier.exclLast, outlier.ao = outlier.ao, - outlier.tc = outlier.tc, outlier.ls = outlier.ls, outlier.so = outlier.so, - outlier.usedefcv = outlier.usedefcv, outlier.cv = outlier.cv, - outlier.eml = outlier.eml, outlier.tcrate = outlier.tcrate, - automdl.enabled = automdl.enabled, automdl.acceptdefault = automdl.acceptdefault, - automdl.cancel = automdl.cancel, automdl.ub1 = automdl.ub1, - automdl.ub2 = automdl.ub2, automdl.armalimit = automdl.armalimit, - automdl.reducecv = automdl.reducecv, automdl.ljungboxlimit = automdl.ljungboxlimit, - automdl.compare = automdl.compare, arima.mu = arima.mu, arima.p = arima.p, - arima.d = arima.d, arima.q = arima.q, arima.bp = arima.bp, - arima.bd = arima.bd, arima.bq = arima.bq, arima.coefEnabled = arima.coefEnabled, - arima.coef = arima.coef, arima.coefType = arima.coefType, - fcst.horizon = fcst.horizon) + regarima <- regarima_spec_tramoseats( + spec = spec, preliminary.check = preliminary.check, + estimate.from = estimate.from, estimate.to = estimate.to, + estimate.first = estimate.first, estimate.last = estimate.last, + estimate.exclFirst = estimate.exclFirst, estimate.exclLast = estimate.exclLast, + estimate.tol = estimate.tol, estimate.eml = estimate.eml, + estimate.urfinal = estimate.urfinal, transform.function = transform.function, + transform.fct = transform.fct, usrdef.outliersEnabled = usrdef.outliersEnabled, + usrdef.outliersType = usrdef.outliersType, usrdef.outliersDate = usrdef.outliersDate, + usrdef.outliersCoef = usrdef.outliersCoef, usrdef.varEnabled = usrdef.varEnabled, + usrdef.var = usrdef.var, usrdef.varType = usrdef.varType, + usrdef.varCoef = usrdef.varCoef, tradingdays.mauto = tradingdays.mauto, + tradingdays.pftd = tradingdays.pftd, tradingdays.option = tradingdays.option, + tradingdays.leapyear = tradingdays.leapyear, tradingdays.stocktd = tradingdays.stocktd, + tradingdays.test = tradingdays.test, easter.type = easter.type, + easter.julian = easter.julian, easter.duration = easter.duration, + easter.test = easter.test, outlier.enabled = outlier.enabled, + outlier.from = outlier.from, outlier.to = outlier.to, outlier.first = outlier.first, + outlier.last = outlier.last, outlier.exclFirst = outlier.exclFirst, + outlier.exclLast = outlier.exclLast, outlier.ao = outlier.ao, + outlier.tc = outlier.tc, outlier.ls = outlier.ls, outlier.so = outlier.so, + outlier.usedefcv = outlier.usedefcv, outlier.cv = outlier.cv, + outlier.eml = outlier.eml, outlier.tcrate = outlier.tcrate, + automdl.enabled = automdl.enabled, automdl.acceptdefault = automdl.acceptdefault, + automdl.cancel = automdl.cancel, automdl.ub1 = automdl.ub1, + automdl.ub2 = automdl.ub2, automdl.armalimit = automdl.armalimit, + automdl.reducecv = automdl.reducecv, automdl.ljungboxlimit = automdl.ljungboxlimit, + automdl.compare = automdl.compare, arima.mu = arima.mu, arima.p = arima.p, + arima.d = arima.d, arima.q = arima.q, arima.bp = arima.bp, + arima.bd = arima.bd, arima.bq = arima.bq, arima.coefEnabled = arima.coefEnabled, + arima.coef = arima.coef, arima.coefType = arima.coefType, + fcst.horizon = fcst.horizon) - seats <- seats_spec(spec = spec, seats.predictionLength = seats.predictionLength, - seats.approx = seats.approx, seats.trendBoundary = seats.trendBoundary, - seats.seasdBoundary = seats.seasdBoundary, seats.seasdBoundary1 = seats.seasdBoundary1, - seats.seasTol = seats.seasTol, seats.maBoundary = seats.maBoundary, - seats.method = seats.method) + seats <- seats_spec( + spec = spec, seats.predictionLength = seats.predictionLength, + seats.approx = seats.approx, seats.trendBoundary = seats.trendBoundary, + seats.seasdBoundary = seats.seasdBoundary, seats.seasdBoundary1 = seats.seasdBoundary1, + seats.seasTol = seats.seasTol, seats.maBoundary = seats.maBoundary, + seats.method = seats.method) + benchmarking <- benchmarking_spec( + spec = spec, + benchmarking.enabled = benchmarking.enabled, + benchmarking.target = benchmarking.target, benchmarking.useforecast = benchmarking.useforecast, + benchmarking.rho = benchmarking.rho, benchmarking.lambda = benchmarking.lambda) - z <- list(regarima = regarima, seats = seats) + z <- list(regarima = regarima, seats = seats, benchmarking = benchmarking) class(z) <- c("SA_spec","TRAMO_SEATS") return(z) } diff --git a/R/user_defined.R b/R/user_defined.R index f48d702..366ab11 100644 --- a/R/user_defined.R +++ b/R/user_defined.R @@ -54,123 +54,133 @@ user_defined_variables <- function(sa_object = c("X13-ARIMA", "TRAMO-SEATS")){ # dput(RJDemetra:::dictionary(jrobct)) # - vars <- c("y", "y_f", "t", "t_f", "sa", "sa_f", "s", "s_f", - "i", "i_f", "mode", "preprocessing.model.span.start", "preprocessing.model.span.end", - "preprocessing.model.span.n", "preprocessing.model.espan.start", - "preprocessing.model.espan.end", "preprocessing.model.espan.n", - "preprocessing.model.log", "preprocessing.model.adjust", "preprocessing.model.y", - "preprocessing.model.y_f", "preprocessing.model.y_ef", "preprocessing.model.yc", - "preprocessing.model.yc_f", "preprocessing.model.yc_ef", "preprocessing.model.l", - "preprocessing.model.y_lin", "preprocessing.model.y_lin_f", "preprocessing.model.ycal", - "preprocessing.model.ycal_f", "preprocessing.model.det", "preprocessing.model.det_f", - "preprocessing.model.l_f", "preprocessing.model.l_b", "preprocessing.model.cal", - "preprocessing.model.cal_f", "preprocessing.model.tde", "preprocessing.model.tde_f", - "preprocessing.model.mhe", "preprocessing.model.mhe_f", "preprocessing.model.ee", - "preprocessing.model.ee_f", "preprocessing.model.omhe", "preprocessing.model.omhe_f", - "preprocessing.model.out(*)", "preprocessing.model.out_f", "preprocessing.model.out_i", - "preprocessing.model.out_i_f", "preprocessing.model.out_t", "preprocessing.model.out_t_f", - "preprocessing.model.out_s", "preprocessing.model.out_s_f", "preprocessing.model.reg", - "preprocessing.model.reg_f", "preprocessing.model.reg_t", "preprocessing.model.reg_t_f", - "preprocessing.model.reg_s", "preprocessing.model.reg_s_f", "preprocessing.model.reg_i", - "preprocessing.model.reg_i_f", "preprocessing.model.reg_sa", - "preprocessing.model.reg_sa_f", "preprocessing.model.reg_y", - "preprocessing.model.reg_y_f", "preprocessing.model.reg_u", "preprocessing.model.reg_u_f", - "preprocessing.model.fullresiduals", "preprocessing.model.lp", - "preprocessing.model.ntd", "preprocessing.model.nmh", "preprocessing.model.td(*)", - "preprocessing.model.easter", "preprocessing.model.nout", "preprocessing.model.noutao", - "preprocessing.model.noutls", "preprocessing.model.nouttc", "preprocessing.model.noutso", - "preprocessing.model.coefficients", "preprocessing.model.description", - "preprocessing.model.covar", "preprocessing.model.pcovar", "preprocessing.model.fcasts(?)", - "preprocessing.model.bcasts(?)", "preprocessing.model.lin_fcasts(?)", - "preprocessing.model.lin_bcasts(?)", "preprocessing.model.efcasts(?)", - "preprocessing.arima.parameters", "preprocessing.arima.p", "preprocessing.arima.d", - "preprocessing.arima.q", "preprocessing.arima.bp", "preprocessing.arima.bd", - "preprocessing.arima.bq", "preprocessing.likelihood.neffectiveobs", - "preprocessing.likelihood.np", "preprocessing.likelihood.logvalue", - "preprocessing.likelihood.adjustedlogvalue", "preprocessing.likelihood.ssqerr", - "preprocessing.likelihood.aic", "preprocessing.likelihood.aicc", - "preprocessing.likelihood.bic", "preprocessing.likelihood.bicc", - "preprocessing.likelihood.ser", "preprocessing.likelihood.ser-ml", - "preprocessing.residuals.res", "preprocessing.residuals.mean", - "preprocessing.residuals.skewness", "preprocessing.residuals.kurtosis", - "preprocessing.residuals.dh", "preprocessing.residuals.lb", "preprocessing.residuals.lb2", - "preprocessing.residuals.seaslb", "preprocessing.residuals.bp", - "preprocessing.residuals.bp2", "preprocessing.residuals.seasbp", - "preprocessing.residuals.nruns", "preprocessing.residuals.lruns", - "mstats.M(*)", "mstats.Q", "mstats.Q-M2", "decomposition.a1", - "decomposition.a1a", "decomposition.a1b", "decomposition.a6", - "decomposition.a7", "decomposition.a8", "decomposition.a8t", - "decomposition.a8s", "decomposition.a8i", "decomposition.a9", - "decomposition.a9sa", "decomposition.a9u", "decomposition.a9ser", - "decomposition.b1", "decomposition.b2", "decomposition.b3", "decomposition.b4", - "decomposition.b5", "decomposition.b6", "decomposition.b7", "decomposition.b8", - "decomposition.b9", "decomposition.b10", "decomposition.b11", - "decomposition.b12", "decomposition.b13", "decomposition.b14", - "decomposition.b15", "decomposition.b16", "decomposition.b17", - "decomposition.b18", "decomposition.b19", "decomposition.b20", - "decomposition.c1", "decomposition.c2", "decomposition.c3", "decomposition.c4", - "decomposition.c5", "decomposition.c6", "decomposition.c7", "decomposition.c8", - "decomposition.c9", "decomposition.c10", "decomposition.c11", - "decomposition.c12", "decomposition.c13", "decomposition.c14", - "decomposition.c15", "decomposition.c16", "decomposition.c17", - "decomposition.c18", "decomposition.c19", "decomposition.c20", - "decomposition.d1", "decomposition.d2", "decomposition.d3", "decomposition.d4", - "decomposition.d5", "decomposition.d6", "decomposition.d7", "decomposition.d8", - "decomposition.d9", "decomposition.d10", "decomposition.d10a", - "decomposition.d10b", "decomposition.d11", "decomposition.d11a", - "decomposition.d12", "decomposition.d12a", "decomposition.d13", - "decomposition.d14", "decomposition.d15", "decomposition.d16", - "decomposition.d16a", "decomposition.d16b", "decomposition.d18", - "decomposition.d19", "decomposition.d20", "decomposition.e1", - "decomposition.e2", "decomposition.e3", "decomposition.e11", - "decomposition.d9filter", "decomposition.slen", "decomposition.d12filter", - "decomposition.tlen", "diagnostics.qs", "diagnostics.ftest", - "diagnostics.qs.on.i", "diagnostics.ftest.on.i", "diagnostics.combined.all.kruskalwallis", - "diagnostics.combined.all.stable", "diagnostics.combined.all.evolutive", - "diagnostics.combined.all.summary", "diagnostics.combined.all.stable.ssm", - "diagnostics.combined.all.stable.ssr", "diagnostics.combined.all.stable.ssq", - "diagnostics.combined.all.evolutive.ssm", "diagnostics.combined.all.evolutive.ssr", - "diagnostics.combined.all.evolutive.ssq", "diagnostics.combined.end.kruskalwallis", - "diagnostics.combined.end.stable", "diagnostics.combined.end.evolutive", - "diagnostics.combined.end.summary", "diagnostics.combined.end.stable.ssm", - "diagnostics.combined.end.stable.ssr", "diagnostics.combined.end.stable.ssq", - "diagnostics.combined.end.evolutive.ssm", "diagnostics.combined.end.evolutive.ssr", - "diagnostics.combined.end.evolutive.ssq", "diagnostics.combined.residual.all.kruskalwallis", - "diagnostics.combined.residual.all.stable", "diagnostics.combined.residual.all.evolutive", - "diagnostics.combined.residual.all.summary", "diagnostics.combined.residual.all.stable.ssm", - "diagnostics.combined.residual.all.stable.ssr", "diagnostics.combined.residual.all.stable.ssq", - "diagnostics.combined.residual.all.evolutive.ssm", "diagnostics.combined.residual.all.evolutive.ssr", - "diagnostics.combined.residual.all.evolutive.ssq", "diagnostics.combined.residual.end.kruskalwallis", - "diagnostics.combined.residual.end.stable", "diagnostics.combined.residual.end.evolutive", - "diagnostics.combined.residual.end.summary", "diagnostics.combined.residual.end.stable.ssm", - "diagnostics.combined.residual.end.stable.ssr", "diagnostics.combined.residual.end.stable.ssq", - "diagnostics.combined.residual.end.evolutive.ssm", "diagnostics.combined.residual.end.evolutive.ssr", - "diagnostics.combined.residual.end.evolutive.ssq", "diagnostics.residual.all", - "diagnostics.residual.end", "diagnostics.residualtd", "diagnostics.residualtd.on.i", - "diagnostics.variancedecomposition", "diagnostics.logstat", "diagnostics.levelstat", - "diagnostics.fcast-insample-mean", "diagnostics.fcast-outsample-mean", - "diagnostics.fcast-outsample-variance", "diagnostics.seas-lin-f", - "diagnostics.seas-lin-qs", "diagnostics.seas-lin-kw", "diagnostics.seas-lin-friedman", - "diagnostics.seas-lin-periodogram", "diagnostics.seas-lin-spectralpeaks", - "diagnostics.seas-si-combined", "diagnostics.seas-si-evolutive", - "diagnostics.seas-si-stable", "diagnostics.seas-res-f", "diagnostics.seas-res-qs", - "diagnostics.seas-res-kw", "diagnostics.seas-res-friedman", "diagnostics.seas-res-periodogram", - "diagnostics.seas-res-spectralpeaks", "diagnostics.seas-res-combined", - "diagnostics.seas-res-combined3", "diagnostics.seas-res-evolutive", - "diagnostics.seas-res-stable", "diagnostics.seas-i-f", "diagnostics.seas-i-qs", - "diagnostics.seas-i-kw", "diagnostics.seas-i-periodogram", "diagnostics.seas-i-spectralpeaks", - "diagnostics.seas-i-combined", "diagnostics.seas-i-combined3", - "diagnostics.seas-i-evolutive", "diagnostics.seas-i-stable", - "diagnostics.seas-sa-f", "diagnostics.seas-sa-qs", "diagnostics.seas-sa-kw", - "diagnostics.seas-sa-friedman", "diagnostics.seas-sa-periodogram", - "diagnostics.seas-sa-spectralpeaks", "diagnostics.seas-sa-combined", - "diagnostics.seas-sa-combined3", "diagnostics.seas-sa-evolutive", - "diagnostics.seas-sa-stable", "diagnostics.seas-sa-ac1", "diagnostics.td-sa-all", - "diagnostics.td-sa-last", "diagnostics.td-i-all", "diagnostics.td-i-last", - "diagnostics.td-res-all", "diagnostics.td-res-last", "diagnostics.ic-ratio-henderson", - "diagnostics.ic-ratio", "diagnostics.msr-global", "diagnostics.msr(*)" + vars <- c( + "y", "y_f", "t", "t_f", "sa", "sa_f", "s", "s_f", + "i", "i_f", "mode", "preprocessing.model.span.start", "preprocessing.model.span.end", + "preprocessing.model.span.n", "preprocessing.model.espan.start", + "preprocessing.model.espan.end", "preprocessing.model.espan.n", + "preprocessing.model.log", "preprocessing.model.adjust", "preprocessing.model.y", + "preprocessing.model.y_f", "preprocessing.model.y_ef", "preprocessing.model.yc", + "preprocessing.model.yc_f", "preprocessing.model.yc_ef", "preprocessing.model.l", + "preprocessing.model.y_lin", "preprocessing.model.y_lin_f", "preprocessing.model.ycal", + "preprocessing.model.ycal_f", "preprocessing.model.det", "preprocessing.model.det_f", + "preprocessing.model.l_f", "preprocessing.model.l_b", "preprocessing.model.cal", + "preprocessing.model.cal_f", "preprocessing.model.tde", "preprocessing.model.tde_f", + "preprocessing.model.mhe", "preprocessing.model.mhe_f", "preprocessing.model.ee", + "preprocessing.model.ee_f", "preprocessing.model.omhe", "preprocessing.model.omhe_f", + "preprocessing.model.out(*)", "preprocessing.model.out_f", "preprocessing.model.out_i", + "preprocessing.model.out_i_f", "preprocessing.model.out_t", "preprocessing.model.out_t_f", + "preprocessing.model.out_s", "preprocessing.model.out_s_f", "preprocessing.model.reg", + "preprocessing.model.reg_f", "preprocessing.model.reg_t", "preprocessing.model.reg_t_f", + "preprocessing.model.reg_s", "preprocessing.model.reg_s_f", "preprocessing.model.reg_i", + "preprocessing.model.reg_i_f", "preprocessing.model.reg_sa", + "preprocessing.model.reg_sa_f", "preprocessing.model.reg_y", + "preprocessing.model.reg_y_f", "preprocessing.model.reg_u", "preprocessing.model.reg_u_f", + "preprocessing.model.fullresiduals", "preprocessing.model.lp", + "preprocessing.model.ntd", "preprocessing.model.nmh", "preprocessing.model.td(*)", + "preprocessing.model.easter", "preprocessing.model.nout", "preprocessing.model.noutao", + "preprocessing.model.noutls", "preprocessing.model.nouttc", "preprocessing.model.noutso", + "preprocessing.model.coefficients", "preprocessing.model.description", + "preprocessing.model.covar", "preprocessing.model.pcovar", "preprocessing.model.fcasts(?)", + "preprocessing.model.bcasts(?)", "preprocessing.model.lin_fcasts(?)", + "preprocessing.model.lin_bcasts(?)", "preprocessing.model.efcasts(?)", + "preprocessing.arima.parameters", "preprocessing.arima.p", "preprocessing.arima.d", + "preprocessing.arima.q", "preprocessing.arima.bp", "preprocessing.arima.bd", + "preprocessing.arima.bq", "preprocessing.likelihood.neffectiveobs", + "preprocessing.likelihood.np", "preprocessing.likelihood.logvalue", + "preprocessing.likelihood.adjustedlogvalue", "preprocessing.likelihood.ssqerr", + "preprocessing.likelihood.aic", "preprocessing.likelihood.aicc", + "preprocessing.likelihood.bic", "preprocessing.likelihood.bicc", + "preprocessing.likelihood.ser", "preprocessing.likelihood.ser-ml", + "preprocessing.residuals.res", "preprocessing.residuals.mean", + "preprocessing.residuals.skewness", "preprocessing.residuals.kurtosis", + "preprocessing.residuals.dh", "preprocessing.residuals.lb", "preprocessing.residuals.lb2", + "preprocessing.residuals.seaslb", "preprocessing.residuals.bp", + "preprocessing.residuals.bp2", "preprocessing.residuals.seasbp", + "preprocessing.residuals.nruns", "preprocessing.residuals.lruns", + "mstats.M(*)", "mstats.Q", "mstats.Q-M2", "decomposition.a1", + "decomposition.a1a", "decomposition.a1b", "decomposition.a6", + "decomposition.a7", "decomposition.a8", "decomposition.a8t", + "decomposition.a8s", "decomposition.a8i", "decomposition.a9", + "decomposition.a9sa", "decomposition.a9u", "decomposition.a9ser", + "decomposition.b1", "decomposition.b2", "decomposition.b3", "decomposition.b4", + "decomposition.b5", "decomposition.b6", "decomposition.b7", "decomposition.b8", + "decomposition.b9", "decomposition.b10", "decomposition.b11", + "decomposition.b12", "decomposition.b13", "decomposition.b14", + "decomposition.b15", "decomposition.b16", "decomposition.b17", + "decomposition.b18", "decomposition.b19", "decomposition.b20", + "decomposition.c1", "decomposition.c2", "decomposition.c3", "decomposition.c4", + "decomposition.c5", "decomposition.c6", "decomposition.c7", "decomposition.c8", + "decomposition.c9", "decomposition.c10", "decomposition.c11", + "decomposition.c12", "decomposition.c13", "decomposition.c14", + "decomposition.c15", "decomposition.c16", "decomposition.c17", + "decomposition.c18", "decomposition.c19", "decomposition.c20", + "decomposition.d1", "decomposition.d2", "decomposition.d3", "decomposition.d4", + "decomposition.d5", "decomposition.d6", "decomposition.d7", "decomposition.d8", + "decomposition.d9", "decomposition.d10", "decomposition.d10a", + "decomposition.d10b", "decomposition.d11", "decomposition.d11a", + "decomposition.d12", "decomposition.d12a", "decomposition.d13", + "decomposition.d14", "decomposition.d15", "decomposition.d16", + "decomposition.d16a", "decomposition.d16b", "decomposition.d18", + "decomposition.d19", "decomposition.d20", "decomposition.e1", + "decomposition.e2", "decomposition.e3", "decomposition.e11", + "decomposition.y_cmp", "decomposition.t_cmp", "decomposition.i_cmp", + "decomposition.s_cmp", "decomposition.sa_cmp", "decomposition.y_cmp_f", + "decomposition.t_cmp_f", "decomposition.i_cmp_f", "decomposition.s_cmp_f", + "decomposition.sa_cmp_f", "decomposition.d9filter", "decomposition.slen", + "decomposition.d12filter", "decomposition.tlen", "diagnostics.qs", + "diagnostics.ftest", "diagnostics.qs.on.i", "diagnostics.ftest.on.i", + "diagnostics.combined.all.kruskalwallis", "diagnostics.combined.all.stable", + "diagnostics.combined.all.evolutive", "diagnostics.combined.all.summary", + "diagnostics.combined.all.stable.ssm", "diagnostics.combined.all.stable.ssr", + "diagnostics.combined.all.stable.ssq", "diagnostics.combined.all.evolutive.ssm", + "diagnostics.combined.all.evolutive.ssr", "diagnostics.combined.all.evolutive.ssq", + "diagnostics.combined.end.kruskalwallis", "diagnostics.combined.end.stable", + "diagnostics.combined.end.evolutive", "diagnostics.combined.end.summary", + "diagnostics.combined.end.stable.ssm", "diagnostics.combined.end.stable.ssr", + "diagnostics.combined.end.stable.ssq", "diagnostics.combined.end.evolutive.ssm", + "diagnostics.combined.end.evolutive.ssr", "diagnostics.combined.end.evolutive.ssq", + "diagnostics.combined.residual.all.kruskalwallis", "diagnostics.combined.residual.all.stable", + "diagnostics.combined.residual.all.evolutive", "diagnostics.combined.residual.all.summary", + "diagnostics.combined.residual.all.stable.ssm", "diagnostics.combined.residual.all.stable.ssr", + "diagnostics.combined.residual.all.stable.ssq", "diagnostics.combined.residual.all.evolutive.ssm", + "diagnostics.combined.residual.all.evolutive.ssr", "diagnostics.combined.residual.all.evolutive.ssq", + "diagnostics.combined.residual.end.kruskalwallis", "diagnostics.combined.residual.end.stable", + "diagnostics.combined.residual.end.evolutive", "diagnostics.combined.residual.end.summary", + "diagnostics.combined.residual.end.stable.ssm", "diagnostics.combined.residual.end.stable.ssr", + "diagnostics.combined.residual.end.stable.ssq", "diagnostics.combined.residual.end.evolutive.ssm", + "diagnostics.combined.residual.end.evolutive.ssr", "diagnostics.combined.residual.end.evolutive.ssq", + "diagnostics.residual.all", "diagnostics.residual.end", "diagnostics.residualtd", + "diagnostics.residualtd.on.i", "diagnostics.variancedecomposition", + "diagnostics.logstat", "diagnostics.levelstat", "diagnostics.fcast-insample-mean", + "diagnostics.fcast-outsample-mean", "diagnostics.fcast-outsample-variance", + "diagnostics.seas-lin-f", "diagnostics.seas-lin-qs", "diagnostics.seas-lin-kw", + "diagnostics.seas-lin-friedman", "diagnostics.seas-lin-periodogram", + "diagnostics.seas-lin-spectralpeaks", "diagnostics.seas-si-combined", + "diagnostics.seas-si-evolutive", "diagnostics.seas-si-stable", + "diagnostics.seas-res-f", "diagnostics.seas-res-qs", "diagnostics.seas-res-kw", + "diagnostics.seas-res-friedman", "diagnostics.seas-res-periodogram", + "diagnostics.seas-res-spectralpeaks", "diagnostics.seas-res-combined", + "diagnostics.seas-res-combined3", "diagnostics.seas-res-evolutive", + "diagnostics.seas-res-stable", "diagnostics.seas-i-f", "diagnostics.seas-i-qs", + "diagnostics.seas-i-kw", "diagnostics.seas-i-periodogram", "diagnostics.seas-i-spectralpeaks", + "diagnostics.seas-i-combined", "diagnostics.seas-i-combined3", + "diagnostics.seas-i-evolutive", "diagnostics.seas-i-stable", + "diagnostics.seas-sa-f", "diagnostics.seas-sa-qs", "diagnostics.seas-sa-kw", + "diagnostics.seas-sa-friedman", "diagnostics.seas-sa-periodogram", + "diagnostics.seas-sa-spectralpeaks", "diagnostics.seas-sa-combined", + "diagnostics.seas-sa-combined3", "diagnostics.seas-sa-evolutive", + "diagnostics.seas-sa-stable", "diagnostics.seas-sa-ac1", "diagnostics.td-sa-all", + "diagnostics.td-sa-last", "diagnostics.td-i-all", "diagnostics.td-i-last", + "diagnostics.td-res-all", "diagnostics.td-res-last", "diagnostics.ic-ratio-henderson", + "diagnostics.ic-ratio", "diagnostics.msr-global", "diagnostics.msr(*)", + "coherence.annualtotals.value", "coherence.annualtotals", "coherence.definition.value", + "coherence.definition", "residuals.normality.value", "residuals.normality", + "residuals.independence.value", "residuals.independence", "residuals.tdpeaks.value", + "residuals.tdpeaks", "residuals.seaspeaks.value", "residuals.seaspeaks", + "benchmarking.original", "benchmarking.target", "benchmarking.result" ) - }else{ + } else { # # To get the variables : # library(rJava) # jrspec<-.jcall("jdr/spec/tramoseats/TramoSeatsSpec", "Ljdr/spec/tramoseats/TramoSeatsSpec;", "of", "RSA0") @@ -184,120 +194,126 @@ user_defined_variables <- function(sa_object = c("X13-ARIMA", "TRAMO-SEATS")){ # # dput(RJDemetra:::dictionary(jrobct)) - vars <- c("y", "y_f", "t", "t_f", "sa", "sa_f", "s", "s_f", - "i", "i_f", "mode", "preprocessing.model.span.start", "preprocessing.model.span.end", - "preprocessing.model.span.n", "preprocessing.model.espan.start", - "preprocessing.model.espan.end", "preprocessing.model.espan.n", - "preprocessing.model.log", "preprocessing.model.adjust", "preprocessing.model.y", - "preprocessing.model.y_f", "preprocessing.model.y_ef", "preprocessing.model.yc", - "preprocessing.model.yc_f", "preprocessing.model.yc_ef", "preprocessing.model.l", - "preprocessing.model.y_lin", "preprocessing.model.y_lin_f", "preprocessing.model.ycal", - "preprocessing.model.ycal_f", "preprocessing.model.det", "preprocessing.model.det_f", - "preprocessing.model.l_f", "preprocessing.model.l_b", "preprocessing.model.cal", - "preprocessing.model.cal_f", "preprocessing.model.tde", "preprocessing.model.tde_f", - "preprocessing.model.mhe", "preprocessing.model.mhe_f", "preprocessing.model.ee", - "preprocessing.model.ee_f", "preprocessing.model.omhe", "preprocessing.model.omhe_f", - "preprocessing.model.out(*)", "preprocessing.model.out_f", "preprocessing.model.out_i", - "preprocessing.model.out_i_f", "preprocessing.model.out_t", "preprocessing.model.out_t_f", - "preprocessing.model.out_s", "preprocessing.model.out_s_f", "preprocessing.model.reg", - "preprocessing.model.reg_f", "preprocessing.model.reg_t", "preprocessing.model.reg_t_f", - "preprocessing.model.reg_s", "preprocessing.model.reg_s_f", "preprocessing.model.reg_i", - "preprocessing.model.reg_i_f", "preprocessing.model.reg_sa", - "preprocessing.model.reg_sa_f", "preprocessing.model.reg_y", - "preprocessing.model.reg_y_f", "preprocessing.model.reg_u", "preprocessing.model.reg_u_f", - "preprocessing.model.fullresiduals", "preprocessing.model.lp", - "preprocessing.model.ntd", "preprocessing.model.nmh", "preprocessing.model.td(*)", - "preprocessing.model.easter", "preprocessing.model.nout", "preprocessing.model.noutao", - "preprocessing.model.noutls", "preprocessing.model.nouttc", "preprocessing.model.noutso", - "preprocessing.model.coefficients", "preprocessing.model.description", - "preprocessing.model.covar", "preprocessing.model.pcovar", "preprocessing.model.fcasts(?)", - "preprocessing.model.bcasts(?)", "preprocessing.model.lin_fcasts(?)", - "preprocessing.model.lin_bcasts(?)", "preprocessing.model.efcasts(?)", - "preprocessing.arima.parameters", "preprocessing.arima.p", "preprocessing.arima.d", - "preprocessing.arima.q", "preprocessing.arima.bp", "preprocessing.arima.bd", - "preprocessing.arima.bq", "preprocessing.likelihood.neffectiveobs", - "preprocessing.likelihood.np", "preprocessing.likelihood.logvalue", - "preprocessing.likelihood.adjustedlogvalue", "preprocessing.likelihood.ssqerr", - "preprocessing.likelihood.aic", "preprocessing.likelihood.aicc", - "preprocessing.likelihood.bic", "preprocessing.likelihood.bicc", - "preprocessing.likelihood.ser", "preprocessing.likelihood.ser-ml", - "preprocessing.residuals.res", "preprocessing.residuals.mean", - "preprocessing.residuals.skewness", "preprocessing.residuals.kurtosis", - "preprocessing.residuals.dh", "preprocessing.residuals.lb", "preprocessing.residuals.lb2", - "preprocessing.residuals.seaslb", "preprocessing.residuals.bp", - "preprocessing.residuals.bp2", "preprocessing.residuals.seasbp", - "preprocessing.residuals.nruns", "preprocessing.residuals.lruns", - "decomposition.y_lin", "decomposition.y_lin_f", "decomposition.y_lin_ef", - "decomposition.t_lin", "decomposition.t_lin_f", "decomposition.t_lin_e", - "decomposition.t_lin_ef", "decomposition.sa_lin", "decomposition.sa_lin_f", - "decomposition.sa_lin_e", "decomposition.sa_lin_ef", "decomposition.s_lin", - "decomposition.s_lin_f", "decomposition.s_lin_e", "decomposition.s_lin_ef", - "decomposition.i_lin", "decomposition.i_lin_f", "decomposition.i_lin_e", - "decomposition.i_lin_ef", "decomposition.y_cmp", "decomposition.y_cmp_f", - "decomposition.t_cmp", "decomposition.t_cmp_f", "decomposition.sa_cmp", - "decomposition.sa_cmp_f", "decomposition.s_cmp", "decomposition.s_cmp_f", - "decomposition.i_cmp", "decomposition.i_cmp_f", "decomposition.i_cmp_e", - "decomposition.t_cmp_e", "decomposition.s_cmp_e", "decomposition.sa_cmp_e", - "decomposition.i_cmp_ef", "decomposition.t_cmp_ef", "decomposition.s_cmp_ef", - "decomposition.sa_cmp_ef", "decomposition.parameterscutoff", - "decomposition.modelchanged", "decomposition.model.ar", "decomposition.model.diff", - "decomposition.model.ma", "decomposition.model.fullar", "decomposition.model.innovationvariance", - "decomposition.tmodel.ar", "decomposition.tmodel.diff", "decomposition.tmodel.ma", - "decomposition.tmodel.fullar", "decomposition.tmodel.innovationvariance", - "decomposition.smodel.ar", "decomposition.smodel.diff", "decomposition.smodel.ma", - "decomposition.smodel.fullar", "decomposition.smodel.innovationvariance", - "decomposition.samodel.ar", "decomposition.samodel.diff", "decomposition.samodel.ma", - "decomposition.samodel.fullar", "decomposition.samodel.innovationvariance", - "decomposition.transitorymodel.ar", "decomposition.transitorymodel.diff", - "decomposition.transitorymodel.ma", "decomposition.transitorymodel.fullar", - "decomposition.transitorymodel.innovationvariance", "decomposition.imodel.ar", - "decomposition.imodel.diff", "decomposition.imodel.ma", "decomposition.imodel.fullar", - "decomposition.imodel.innovationvariance", "diagnostics.qs", - "diagnostics.ftest", "diagnostics.qs.on.i", "diagnostics.ftest.on.i", - "diagnostics.combined.all.kruskalwallis", "diagnostics.combined.all.stable", - "diagnostics.combined.all.evolutive", "diagnostics.combined.all.summary", - "diagnostics.combined.all.stable.ssm", "diagnostics.combined.all.stable.ssr", - "diagnostics.combined.all.stable.ssq", "diagnostics.combined.all.evolutive.ssm", - "diagnostics.combined.all.evolutive.ssr", "diagnostics.combined.all.evolutive.ssq", - "diagnostics.combined.end.kruskalwallis", "diagnostics.combined.end.stable", - "diagnostics.combined.end.evolutive", "diagnostics.combined.end.summary", - "diagnostics.combined.end.stable.ssm", "diagnostics.combined.end.stable.ssr", - "diagnostics.combined.end.stable.ssq", "diagnostics.combined.end.evolutive.ssm", - "diagnostics.combined.end.evolutive.ssr", "diagnostics.combined.end.evolutive.ssq", - "diagnostics.combined.residual.all.kruskalwallis", "diagnostics.combined.residual.all.stable", - "diagnostics.combined.residual.all.evolutive", "diagnostics.combined.residual.all.summary", - "diagnostics.combined.residual.all.stable.ssm", "diagnostics.combined.residual.all.stable.ssr", - "diagnostics.combined.residual.all.stable.ssq", "diagnostics.combined.residual.all.evolutive.ssm", - "diagnostics.combined.residual.all.evolutive.ssr", "diagnostics.combined.residual.all.evolutive.ssq", - "diagnostics.combined.residual.end.kruskalwallis", "diagnostics.combined.residual.end.stable", - "diagnostics.combined.residual.end.evolutive", "diagnostics.combined.residual.end.summary", - "diagnostics.combined.residual.end.stable.ssm", "diagnostics.combined.residual.end.stable.ssr", - "diagnostics.combined.residual.end.stable.ssq", "diagnostics.combined.residual.end.evolutive.ssm", - "diagnostics.combined.residual.end.evolutive.ssr", "diagnostics.combined.residual.end.evolutive.ssq", - "diagnostics.residual.all", "diagnostics.residual.end", "diagnostics.residualtd", - "diagnostics.residualtd.on.i", "diagnostics.variancedecomposition", - "diagnostics.logstat", "diagnostics.levelstat", "diagnostics.fcast-insample-mean", - "diagnostics.fcast-outsample-mean", "diagnostics.fcast-outsample-variance", - "diagnostics.seas-lin-f", "diagnostics.seas-lin-qs", "diagnostics.seas-lin-kw", - "diagnostics.seas-lin-friedman", "diagnostics.seas-lin-periodogram", - "diagnostics.seas-lin-spectralpeaks", "diagnostics.seas-si-combined", - "diagnostics.seas-si-evolutive", "diagnostics.seas-si-stable", - "diagnostics.seas-res-f", "diagnostics.seas-res-qs", "diagnostics.seas-res-kw", - "diagnostics.seas-res-friedman", "diagnostics.seas-res-periodogram", - "diagnostics.seas-res-spectralpeaks", "diagnostics.seas-res-combined", - "diagnostics.seas-res-combined3", "diagnostics.seas-res-evolutive", - "diagnostics.seas-res-stable", "diagnostics.seas-i-f", "diagnostics.seas-i-qs", - "diagnostics.seas-i-kw", "diagnostics.seas-i-periodogram", "diagnostics.seas-i-spectralpeaks", - "diagnostics.seas-i-combined", "diagnostics.seas-i-combined3", - "diagnostics.seas-i-evolutive", "diagnostics.seas-i-stable", - "diagnostics.seas-sa-f", "diagnostics.seas-sa-qs", "diagnostics.seas-sa-kw", - "diagnostics.seas-sa-friedman", "diagnostics.seas-sa-periodogram", - "diagnostics.seas-sa-spectralpeaks", "diagnostics.seas-sa-combined", - "diagnostics.seas-sa-combined3", "diagnostics.seas-sa-evolutive", - "diagnostics.seas-sa-stable", "diagnostics.seas-sa-ac1", "diagnostics.td-sa-all", - "diagnostics.td-sa-last", "diagnostics.td-i-all", "diagnostics.td-i-last", - "diagnostics.td-res-all", "diagnostics.td-res-last", "diagnostics.ic-ratio-henderson", - "diagnostics.ic-ratio", "diagnostics.msr-global", "diagnostics.msr(*)" + vars <- c( + "y", "y_f", "t", "t_f", "sa", "sa_f", "s", "s_f", + "i", "i_f", "mode", "preprocessing.model.span.start", "preprocessing.model.span.end", + "preprocessing.model.span.n", "preprocessing.model.espan.start", + "preprocessing.model.espan.end", "preprocessing.model.espan.n", + "preprocessing.model.log", "preprocessing.model.adjust", "preprocessing.model.y", + "preprocessing.model.y_f", "preprocessing.model.y_ef", "preprocessing.model.yc", + "preprocessing.model.yc_f", "preprocessing.model.yc_ef", "preprocessing.model.l", + "preprocessing.model.y_lin", "preprocessing.model.y_lin_f", "preprocessing.model.ycal", + "preprocessing.model.ycal_f", "preprocessing.model.det", "preprocessing.model.det_f", + "preprocessing.model.l_f", "preprocessing.model.l_b", "preprocessing.model.cal", + "preprocessing.model.cal_f", "preprocessing.model.tde", "preprocessing.model.tde_f", + "preprocessing.model.mhe", "preprocessing.model.mhe_f", "preprocessing.model.ee", + "preprocessing.model.ee_f", "preprocessing.model.omhe", "preprocessing.model.omhe_f", + "preprocessing.model.out(*)", "preprocessing.model.out_f", "preprocessing.model.out_i", + "preprocessing.model.out_i_f", "preprocessing.model.out_t", "preprocessing.model.out_t_f", + "preprocessing.model.out_s", "preprocessing.model.out_s_f", "preprocessing.model.reg", + "preprocessing.model.reg_f", "preprocessing.model.reg_t", "preprocessing.model.reg_t_f", + "preprocessing.model.reg_s", "preprocessing.model.reg_s_f", "preprocessing.model.reg_i", + "preprocessing.model.reg_i_f", "preprocessing.model.reg_sa", + "preprocessing.model.reg_sa_f", "preprocessing.model.reg_y", + "preprocessing.model.reg_y_f", "preprocessing.model.reg_u", "preprocessing.model.reg_u_f", + "preprocessing.model.fullresiduals", "preprocessing.model.lp", + "preprocessing.model.ntd", "preprocessing.model.nmh", "preprocessing.model.td(*)", + "preprocessing.model.easter", "preprocessing.model.nout", "preprocessing.model.noutao", + "preprocessing.model.noutls", "preprocessing.model.nouttc", "preprocessing.model.noutso", + "preprocessing.model.coefficients", "preprocessing.model.description", + "preprocessing.model.covar", "preprocessing.model.pcovar", "preprocessing.model.fcasts(?)", + "preprocessing.model.bcasts(?)", "preprocessing.model.lin_fcasts(?)", + "preprocessing.model.lin_bcasts(?)", "preprocessing.model.efcasts(?)", + "preprocessing.arima.parameters", "preprocessing.arima.p", "preprocessing.arima.d", + "preprocessing.arima.q", "preprocessing.arima.bp", "preprocessing.arima.bd", + "preprocessing.arima.bq", "preprocessing.likelihood.neffectiveobs", + "preprocessing.likelihood.np", "preprocessing.likelihood.logvalue", + "preprocessing.likelihood.adjustedlogvalue", "preprocessing.likelihood.ssqerr", + "preprocessing.likelihood.aic", "preprocessing.likelihood.aicc", + "preprocessing.likelihood.bic", "preprocessing.likelihood.bicc", + "preprocessing.likelihood.ser", "preprocessing.likelihood.ser-ml", + "preprocessing.residuals.res", "preprocessing.residuals.mean", + "preprocessing.residuals.skewness", "preprocessing.residuals.kurtosis", + "preprocessing.residuals.dh", "preprocessing.residuals.lb", "preprocessing.residuals.lb2", + "preprocessing.residuals.seaslb", "preprocessing.residuals.bp", + "preprocessing.residuals.bp2", "preprocessing.residuals.seasbp", + "preprocessing.residuals.nruns", "preprocessing.residuals.lruns", + "decomposition.y_lin", "decomposition.y_lin_f", "decomposition.y_lin_ef", + "decomposition.t_lin", "decomposition.t_lin_f", "decomposition.t_lin_e", + "decomposition.t_lin_ef", "decomposition.sa_lin", "decomposition.sa_lin_f", + "decomposition.sa_lin_e", "decomposition.sa_lin_ef", "decomposition.s_lin", + "decomposition.s_lin_f", "decomposition.s_lin_e", "decomposition.s_lin_ef", + "decomposition.i_lin", "decomposition.i_lin_f", "decomposition.i_lin_e", + "decomposition.i_lin_ef", "decomposition.y_cmp", "decomposition.y_cmp_f", + "decomposition.t_cmp", "decomposition.t_cmp_f", "decomposition.sa_cmp", + "decomposition.sa_cmp_f", "decomposition.s_cmp", "decomposition.s_cmp_f", + "decomposition.i_cmp", "decomposition.i_cmp_f", "decomposition.i_cmp_e", + "decomposition.t_cmp_e", "decomposition.s_cmp_e", "decomposition.sa_cmp_e", + "decomposition.i_cmp_ef", "decomposition.t_cmp_ef", "decomposition.s_cmp_ef", + "decomposition.sa_cmp_ef", "decomposition.parameterscutoff", + "decomposition.modelchanged", "decomposition.model.ar", "decomposition.model.diff", + "decomposition.model.ma", "decomposition.model.fullar", "decomposition.model.innovationvariance", + "decomposition.tmodel.ar", "decomposition.tmodel.diff", "decomposition.tmodel.ma", + "decomposition.tmodel.fullar", "decomposition.tmodel.innovationvariance", + "decomposition.smodel.ar", "decomposition.smodel.diff", "decomposition.smodel.ma", + "decomposition.smodel.fullar", "decomposition.smodel.innovationvariance", + "decomposition.samodel.ar", "decomposition.samodel.diff", "decomposition.samodel.ma", + "decomposition.samodel.fullar", "decomposition.samodel.innovationvariance", + "decomposition.transitorymodel.ar", "decomposition.transitorymodel.diff", + "decomposition.transitorymodel.ma", "decomposition.transitorymodel.fullar", + "decomposition.transitorymodel.innovationvariance", "decomposition.imodel.ar", + "decomposition.imodel.diff", "decomposition.imodel.ma", "decomposition.imodel.fullar", + "decomposition.imodel.innovationvariance", "diagnostics.qs", + "diagnostics.ftest", "diagnostics.qs.on.i", "diagnostics.ftest.on.i", + "diagnostics.combined.all.kruskalwallis", "diagnostics.combined.all.stable", + "diagnostics.combined.all.evolutive", "diagnostics.combined.all.summary", + "diagnostics.combined.all.stable.ssm", "diagnostics.combined.all.stable.ssr", + "diagnostics.combined.all.stable.ssq", "diagnostics.combined.all.evolutive.ssm", + "diagnostics.combined.all.evolutive.ssr", "diagnostics.combined.all.evolutive.ssq", + "diagnostics.combined.end.kruskalwallis", "diagnostics.combined.end.stable", + "diagnostics.combined.end.evolutive", "diagnostics.combined.end.summary", + "diagnostics.combined.end.stable.ssm", "diagnostics.combined.end.stable.ssr", + "diagnostics.combined.end.stable.ssq", "diagnostics.combined.end.evolutive.ssm", + "diagnostics.combined.end.evolutive.ssr", "diagnostics.combined.end.evolutive.ssq", + "diagnostics.combined.residual.all.kruskalwallis", "diagnostics.combined.residual.all.stable", + "diagnostics.combined.residual.all.evolutive", "diagnostics.combined.residual.all.summary", + "diagnostics.combined.residual.all.stable.ssm", "diagnostics.combined.residual.all.stable.ssr", + "diagnostics.combined.residual.all.stable.ssq", "diagnostics.combined.residual.all.evolutive.ssm", + "diagnostics.combined.residual.all.evolutive.ssr", "diagnostics.combined.residual.all.evolutive.ssq", + "diagnostics.combined.residual.end.kruskalwallis", "diagnostics.combined.residual.end.stable", + "diagnostics.combined.residual.end.evolutive", "diagnostics.combined.residual.end.summary", + "diagnostics.combined.residual.end.stable.ssm", "diagnostics.combined.residual.end.stable.ssr", + "diagnostics.combined.residual.end.stable.ssq", "diagnostics.combined.residual.end.evolutive.ssm", + "diagnostics.combined.residual.end.evolutive.ssr", "diagnostics.combined.residual.end.evolutive.ssq", + "diagnostics.residual.all", "diagnostics.residual.end", "diagnostics.residualtd", + "diagnostics.residualtd.on.i", "diagnostics.variancedecomposition", + "diagnostics.logstat", "diagnostics.levelstat", "diagnostics.fcast-insample-mean", + "diagnostics.fcast-outsample-mean", "diagnostics.fcast-outsample-variance", + "diagnostics.seas-lin-f", "diagnostics.seas-lin-qs", "diagnostics.seas-lin-kw", + "diagnostics.seas-lin-friedman", "diagnostics.seas-lin-periodogram", + "diagnostics.seas-lin-spectralpeaks", "diagnostics.seas-si-combined", + "diagnostics.seas-si-evolutive", "diagnostics.seas-si-stable", + "diagnostics.seas-res-f", "diagnostics.seas-res-qs", "diagnostics.seas-res-kw", + "diagnostics.seas-res-friedman", "diagnostics.seas-res-periodogram", + "diagnostics.seas-res-spectralpeaks", "diagnostics.seas-res-combined", + "diagnostics.seas-res-combined3", "diagnostics.seas-res-evolutive", + "diagnostics.seas-res-stable", "diagnostics.seas-i-f", "diagnostics.seas-i-qs", + "diagnostics.seas-i-kw", "diagnostics.seas-i-periodogram", "diagnostics.seas-i-spectralpeaks", + "diagnostics.seas-i-combined", "diagnostics.seas-i-combined3", + "diagnostics.seas-i-evolutive", "diagnostics.seas-i-stable", + "diagnostics.seas-sa-f", "diagnostics.seas-sa-qs", "diagnostics.seas-sa-kw", + "diagnostics.seas-sa-friedman", "diagnostics.seas-sa-periodogram", + "diagnostics.seas-sa-spectralpeaks", "diagnostics.seas-sa-combined", + "diagnostics.seas-sa-combined3", "diagnostics.seas-sa-evolutive", + "diagnostics.seas-sa-stable", "diagnostics.seas-sa-ac1", "diagnostics.td-sa-all", + "diagnostics.td-sa-last", "diagnostics.td-i-all", "diagnostics.td-i-last", + "diagnostics.td-res-all", "diagnostics.td-res-last", "diagnostics.ic-ratio-henderson", + "diagnostics.ic-ratio", "diagnostics.msr-global", "diagnostics.msr(*)", + "coherence.annualtotals.value", "coherence.annualtotals", "coherence.definition.value", + "coherence.definition", "residuals.normality.value", "residuals.normality", + "residuals.independence.value", "residuals.independence", "residuals.tdpeaks.value", + "residuals.tdpeaks", "residuals.seaspeaks.value", "residuals.seaspeaks", + "benchmarking.original", "benchmarking.target", "benchmarking.result" ) } vars diff --git a/R/x13.R b/R/x13.R index 530034a..f2a6dfd 100644 --- a/R/x13.R +++ b/R/x13.R @@ -130,6 +130,7 @@ x13.SA_spec <- function(series, spec, userdefined = NULL){ } jdictionary <- spec_regarima_X13_r2jd(spec, jdspec) seasma <- specX11_r2jd(spec,jdspec, freq = frequency(series)) + spec_benchmarking_r2jd(rspec = spec, jdspec = jdspec) jspec <- .jcall(jdspec, "Lec/satoolkit/x13/X13Specification;", "getCore") jrslt <- .jcall("ec/tstoolkit/jdr/sa/Processor", "Lec/tstoolkit/jdr/sa/X13Results;", "x13", ts_r2jd(series), jspec, jdictionary) @@ -158,10 +159,12 @@ x13.SA_spec <- function(series, spec, userdefined = NULL){ } reg <- regarima_X13(jrobj = jrobct_arima, spec = spec$regarima) deco <- decomp_X13(jrobj = jrobct, spec = spec$x11, seasma = seasma) + bench <- benchmarking(jrobj = jrobct, spec = spec$benchmarking) fin <- final(jrobj = jrobct) diagn <- diagnostics(jrobj = jrobct) z <- list(regarima = reg, decomposition = deco, final = fin, diagnostics = diagn, + benchmarking = bench, user_defined = user_defined(userdefined, jrobct)) class(z) <- c("SA", "X13") @@ -207,11 +210,13 @@ x13JavaResults <- function(jrslt, spec, userdefined = NULL, context_dictionary = context_dictionary, extra_info = extra_info, freq = freq) deco <- decomp_defX13(jrobj = jrobct, spec = spec, freq = freq) + bench <- benchmarking_def(jrobj = jrobct, spec) fin <- final(jrobj = jrobct) diagn <- diagnostics(jrobj = jrobct) z <- list(regarima = reg, decomposition = deco, final = fin, diagnostics = diagn, + benchmarking = bench, user_defined = user_defined(userdefined, jrobct)) class(z) <- c("SA","X13") diff --git a/R/x13_spec.R b/R/x13_spec.R index 42eeb79..b26013c 100644 --- a/R/x13_spec.R +++ b/R/x13_spec.R @@ -44,6 +44,11 @@ #' detection and adjustment will be computed. Only used if \code{x11.calendarSigma = "Select"}. Possible values are: "Group1" and "Group2". #' @param x11.excludeFcasts logical: to exclude forecasts and backcasts. If \code{TRUE}, the RegARIMA model forecasts and backcasts are not used during the detection of extreme values in the seasonal adjustment routines. #' +#' @param benchmarking.enabled logical: to enable benchmarking. If \code{TRUE}, the benchmarking is enabled. +#' @param benchmarking.target character: the target of the benchmarking procedure, which can be the raw series (\code{"Original"}) or the series the adjusted for calendar effects (\code{"CalendarAdjusted"}). +#' @param benchmarking.useforecast logical: If \code{TRUE}, the forecasts of the seasonally adjusted variable and of the target variable are used in the benchmarking computation so the benchmarking constrains is also applied to the forecasting period. +#' @param benchmarking.rho numeric: the value of the AR(1) parameter (set between 0 and 1) in the function used for benchmarking. +#' @param benchmarking.lambda numeric: a parameter used for benchmarking that relatesto to the weights in the regression equation. It is typically equal to 0, 1/2 or 1. #' @details #' #' The available predefined 'JDemetra+' model specifications are described in the table below: @@ -229,7 +234,13 @@ x13_spec <- function(spec = c("RSA5c", "RSA0", "RSA1", "RSA2c", "RSA3", "RSA4c", x11.bcasts = NA_integer_, x11.calendarSigma = NA, x11.sigmaVector = NA, - x11.excludeFcasts = NA){ + x11.excludeFcasts = NA, + benchmarking.enabled = NA, + benchmarking.target = c(NA, "Original", "CalendarAdjusted"), + benchmarking.useforecast = NA, + benchmarking.rho = NA_real_, + benchmarking.lambda = NA_real_ + ){ UseMethod("x13_spec", spec) } #' @export @@ -310,7 +321,12 @@ x13_spec.character <- function(spec = c("RSA5c", "RSA0", "RSA1", "RSA2c", "RSA3" x11.bcasts = NA_integer_, x11.calendarSigma = NA, x11.sigmaVector = NA, - x11.excludeFcasts = NA) + x11.excludeFcasts = NA, + benchmarking.enabled = NA, + benchmarking.target = c(NA, "Original", "CalendarAdjusted"), + benchmarking.useforecast = NA, + benchmarking.rho = NA_real_, + benchmarking.lambda = NA_real_) { spec <- match.arg(spec) reg_spec <- gsub("RSA", "RG", spec) @@ -318,47 +334,56 @@ x13_spec.character <- function(spec = c("RSA5c", "RSA0", "RSA1", "RSA2c", "RSA3" regarima <- new_regarima_spec_x13() } else{ regarima <- - regarima_spec_x13(spec = reg_spec, preliminary.check = preliminary.check, - estimate.from = estimate.from, estimate.to = estimate.to, - estimate.first = estimate.first, estimate.last = estimate.last, - estimate.exclFirst = estimate.exclFirst, estimate.exclLast = estimate.exclLast, - estimate.tol = estimate.tol, transform.function = transform.function, - transform.adjust = transform.adjust, transform.aicdiff = transform.aicdiff, - usrdef.outliersEnabled = usrdef.outliersEnabled, usrdef.outliersType = usrdef.outliersType, - usrdef.outliersDate = usrdef.outliersDate, usrdef.outliersCoef = usrdef.outliersCoef, - usrdef.varEnabled = usrdef.varEnabled, usrdef.var = usrdef.var, - usrdef.varType = usrdef.varType, usrdef.varCoef = usrdef.varCoef, - tradingdays.option = tradingdays.option, tradingdays.autoadjust = tradingdays.autoadjust, - tradingdays.leapyear = tradingdays.leapyear, tradingdays.stocktd = tradingdays.stocktd, - tradingdays.test = tradingdays.test, easter.enabled = easter.enabled, - easter.julian = easter.julian, easter.duration = easter.duration, - easter.test = easter.test, outlier.enabled = outlier.enabled, - outlier.from = outlier.from, outlier.to = outlier.to, outlier.first = outlier.first, - outlier.last = outlier.last, outlier.exclFirst = outlier.exclFirst, - outlier.exclLast = outlier.exclLast, outlier.ao = outlier.ao, - outlier.tc = outlier.tc, outlier.ls = outlier.ls, outlier.so = outlier.so, - outlier.usedefcv = outlier.usedefcv, outlier.cv = outlier.cv, - outlier.method = outlier.method, outlier.tcrate = outlier.tcrate, - automdl.enabled = automdl.enabled, automdl.acceptdefault = automdl.acceptdefault, - automdl.cancel = automdl.cancel, automdl.ub1 = automdl.ub1, - automdl.ub2 = automdl.ub2, automdl.mixed = automdl.mixed, - automdl.balanced = automdl.balanced, automdl.armalimit = automdl.armalimit, - automdl.reducecv = automdl.reducecv, automdl.ljungboxlimit = automdl.ljungboxlimit, - automdl.ubfinal = automdl.ubfinal, arima.mu = arima.mu, arima.p = arima.p, - arima.d = arima.d, arima.q = arima.q, arima.bp = arima.bp, - arima.bd = arima.bd, arima.bq = arima.bq, arima.coefEnabled = arima.coefEnabled, - arima.coef = arima.coef, arima.coefType = arima.coefType, - fcst.horizon = fcst.horizon) + regarima_spec_x13( + spec = reg_spec, preliminary.check = preliminary.check, + estimate.from = estimate.from, estimate.to = estimate.to, + estimate.first = estimate.first, estimate.last = estimate.last, + estimate.exclFirst = estimate.exclFirst, estimate.exclLast = estimate.exclLast, + estimate.tol = estimate.tol, transform.function = transform.function, + transform.adjust = transform.adjust, transform.aicdiff = transform.aicdiff, + usrdef.outliersEnabled = usrdef.outliersEnabled, usrdef.outliersType = usrdef.outliersType, + usrdef.outliersDate = usrdef.outliersDate, usrdef.outliersCoef = usrdef.outliersCoef, + usrdef.varEnabled = usrdef.varEnabled, usrdef.var = usrdef.var, + usrdef.varType = usrdef.varType, usrdef.varCoef = usrdef.varCoef, + tradingdays.option = tradingdays.option, tradingdays.autoadjust = tradingdays.autoadjust, + tradingdays.leapyear = tradingdays.leapyear, tradingdays.stocktd = tradingdays.stocktd, + tradingdays.test = tradingdays.test, easter.enabled = easter.enabled, + easter.julian = easter.julian, easter.duration = easter.duration, + easter.test = easter.test, outlier.enabled = outlier.enabled, + outlier.from = outlier.from, outlier.to = outlier.to, outlier.first = outlier.first, + outlier.last = outlier.last, outlier.exclFirst = outlier.exclFirst, + outlier.exclLast = outlier.exclLast, outlier.ao = outlier.ao, + outlier.tc = outlier.tc, outlier.ls = outlier.ls, outlier.so = outlier.so, + outlier.usedefcv = outlier.usedefcv, outlier.cv = outlier.cv, + outlier.method = outlier.method, outlier.tcrate = outlier.tcrate, + automdl.enabled = automdl.enabled, automdl.acceptdefault = automdl.acceptdefault, + automdl.cancel = automdl.cancel, automdl.ub1 = automdl.ub1, + automdl.ub2 = automdl.ub2, automdl.mixed = automdl.mixed, + automdl.balanced = automdl.balanced, automdl.armalimit = automdl.armalimit, + automdl.reducecv = automdl.reducecv, automdl.ljungboxlimit = automdl.ljungboxlimit, + automdl.ubfinal = automdl.ubfinal, arima.mu = arima.mu, arima.p = arima.p, + arima.d = arima.d, arima.q = arima.q, arima.bp = arima.bp, + arima.bd = arima.bd, arima.bq = arima.bq, arima.coefEnabled = arima.coefEnabled, + arima.coef = arima.coef, arima.coefType = arima.coefType, + fcst.horizon = fcst.horizon) } - x11 <- x11_spec_def(spec = spec, x11.mode = x11.mode, - x11.seasonalComp = x11.seasonalComp, x11.lsigma = x11.lsigma, - x11.usigma = x11.usigma, x11.trendAuto = x11.trendAuto, - x11.trendma = x11.trendma, x11.seasonalma = x11.seasonalma, - x11.fcasts = x11.fcasts, x11.bcasts = x11.bcasts, - x11.calendarSigma = x11.calendarSigma, x11.sigmaVector = x11.sigmaVector, - x11.excludeFcasts = x11.excludeFcasts) - z <- list(regarima = regarima, x11 = x11) + x11 <- x11_spec_def( + spec = spec, x11.mode = x11.mode, + x11.seasonalComp = x11.seasonalComp, x11.lsigma = x11.lsigma, + x11.usigma = x11.usigma, x11.trendAuto = x11.trendAuto, + x11.trendma = x11.trendma, x11.seasonalma = x11.seasonalma, + x11.fcasts = x11.fcasts, x11.bcasts = x11.bcasts, + x11.calendarSigma = x11.calendarSigma, x11.sigmaVector = x11.sigmaVector, + x11.excludeFcasts = x11.excludeFcasts) + benchmarking <- benchmarking_spec_def( + spec = spec, + benchmarking.enabled = benchmarking.enabled, + benchmarking.target = benchmarking.target, + benchmarking.useforecast = benchmarking.useforecast, + benchmarking.rho = benchmarking.rho, + benchmarking.lambda = benchmarking.lambda) + z <- list(regarima = regarima, x11 = x11, benchmarking = benchmarking) class(z) <- c("SA_spec", "X13") return(z) } @@ -440,51 +465,65 @@ x13_spec.X13 <- function(spec, x11.bcasts = NA_integer_, x11.calendarSigma = NA, x11.sigmaVector = NA, - x11.excludeFcasts = NA) + x11.excludeFcasts = NA, + benchmarking.enabled = NA, + benchmarking.target = c(NA, "Original", "CalendarAdjusted"), + benchmarking.useforecast = NA, + benchmarking.rho = NA_real_, + benchmarking.lambda = NA_real_) { if (!inherits(spec, c("SA","SA_spec"))) stop("This function must only be used with c(\"SA\",\"X13\") and c(\"SA_spec\",\"X13\") objects", call. = FALSE) - regarima <- regarima_spec_x13(spec = spec, preliminary.check = preliminary.check, - estimate.from = estimate.from, estimate.to = estimate.to, - estimate.first = estimate.first, estimate.last = estimate.last, - estimate.exclFirst = estimate.exclFirst, estimate.exclLast = estimate.exclLast, - estimate.tol = estimate.tol, transform.function = transform.function, - transform.adjust = transform.adjust, transform.aicdiff = transform.aicdiff, - usrdef.outliersEnabled = usrdef.outliersEnabled, usrdef.outliersType = usrdef.outliersType, - usrdef.outliersDate = usrdef.outliersDate, usrdef.outliersCoef = usrdef.outliersCoef, - usrdef.varEnabled = usrdef.varEnabled, usrdef.var = usrdef.var, - usrdef.varType = usrdef.varType, usrdef.varCoef = usrdef.varCoef, - tradingdays.option = tradingdays.option, tradingdays.autoadjust = tradingdays.autoadjust, - tradingdays.leapyear = tradingdays.leapyear, tradingdays.stocktd = tradingdays.stocktd, - tradingdays.test = tradingdays.test, easter.enabled = easter.enabled, - easter.julian = easter.julian, easter.duration = easter.duration, - easter.test = easter.test, outlier.enabled = outlier.enabled, - outlier.from = outlier.from, outlier.to = outlier.to, outlier.first = outlier.first, - outlier.last = outlier.last, outlier.exclFirst = outlier.exclFirst, - outlier.exclLast = outlier.exclLast, outlier.ao = outlier.ao, - outlier.tc = outlier.tc, outlier.ls = outlier.ls, outlier.so = outlier.so, - outlier.usedefcv = outlier.usedefcv, outlier.cv = outlier.cv, - outlier.method = outlier.method, outlier.tcrate = outlier.tcrate, - automdl.enabled = automdl.enabled, automdl.acceptdefault = automdl.acceptdefault, - automdl.cancel = automdl.cancel, automdl.ub1 = automdl.ub1, - automdl.ub2 = automdl.ub2, automdl.mixed = automdl.mixed, - automdl.balanced = automdl.balanced, automdl.armalimit = automdl.armalimit, - automdl.reducecv = automdl.reducecv, automdl.ljungboxlimit = automdl.ljungboxlimit, - automdl.ubfinal = automdl.ubfinal, arima.mu = arima.mu, arima.p = arima.p, - arima.d = arima.d, arima.q = arima.q, arima.bp = arima.bp, - arima.bd = arima.bd, arima.bq = arima.bq, arima.coefEnabled = arima.coefEnabled, - arima.coef = arima.coef, arima.coefType = arima.coefType, - fcst.horizon = fcst.horizon) + regarima <- regarima_spec_x13( + spec = spec, preliminary.check = preliminary.check, + estimate.from = estimate.from, estimate.to = estimate.to, + estimate.first = estimate.first, estimate.last = estimate.last, + estimate.exclFirst = estimate.exclFirst, estimate.exclLast = estimate.exclLast, + estimate.tol = estimate.tol, transform.function = transform.function, + transform.adjust = transform.adjust, transform.aicdiff = transform.aicdiff, + usrdef.outliersEnabled = usrdef.outliersEnabled, usrdef.outliersType = usrdef.outliersType, + usrdef.outliersDate = usrdef.outliersDate, usrdef.outliersCoef = usrdef.outliersCoef, + usrdef.varEnabled = usrdef.varEnabled, usrdef.var = usrdef.var, + usrdef.varType = usrdef.varType, usrdef.varCoef = usrdef.varCoef, + tradingdays.option = tradingdays.option, tradingdays.autoadjust = tradingdays.autoadjust, + tradingdays.leapyear = tradingdays.leapyear, tradingdays.stocktd = tradingdays.stocktd, + tradingdays.test = tradingdays.test, easter.enabled = easter.enabled, + easter.julian = easter.julian, easter.duration = easter.duration, + easter.test = easter.test, outlier.enabled = outlier.enabled, + outlier.from = outlier.from, outlier.to = outlier.to, outlier.first = outlier.first, + outlier.last = outlier.last, outlier.exclFirst = outlier.exclFirst, + outlier.exclLast = outlier.exclLast, outlier.ao = outlier.ao, + outlier.tc = outlier.tc, outlier.ls = outlier.ls, outlier.so = outlier.so, + outlier.usedefcv = outlier.usedefcv, outlier.cv = outlier.cv, + outlier.method = outlier.method, outlier.tcrate = outlier.tcrate, + automdl.enabled = automdl.enabled, automdl.acceptdefault = automdl.acceptdefault, + automdl.cancel = automdl.cancel, automdl.ub1 = automdl.ub1, + automdl.ub2 = automdl.ub2, automdl.mixed = automdl.mixed, + automdl.balanced = automdl.balanced, automdl.armalimit = automdl.armalimit, + automdl.reducecv = automdl.reducecv, automdl.ljungboxlimit = automdl.ljungboxlimit, + automdl.ubfinal = automdl.ubfinal, arima.mu = arima.mu, arima.p = arima.p, + arima.d = arima.d, arima.q = arima.q, arima.bp = arima.bp, + arima.bd = arima.bd, arima.bq = arima.bq, arima.coefEnabled = arima.coefEnabled, + arima.coef = arima.coef, arima.coefType = arima.coefType, + fcst.horizon = fcst.horizon) - x11 <- x11_spec(spec = spec, x11.mode = x11.mode, - x11.seasonalComp = x11.seasonalComp, x11.lsigma = x11.lsigma, - x11.usigma = x11.usigma, x11.trendAuto = x11.trendAuto, - x11.trendma = x11.trendma, x11.seasonalma = x11.seasonalma, - x11.fcasts = x11.fcasts, x11.bcasts = x11.bcasts, - x11.calendarSigma = x11.calendarSigma, x11.sigmaVector = x11.sigmaVector, - x11.excludeFcasts = x11.excludeFcasts) - z <- list(regarima = regarima, x11 = x11) + x11 <- x11_spec( + spec = spec, x11.mode = x11.mode, + x11.seasonalComp = x11.seasonalComp, x11.lsigma = x11.lsigma, + x11.usigma = x11.usigma, x11.trendAuto = x11.trendAuto, + x11.trendma = x11.trendma, x11.seasonalma = x11.seasonalma, + x11.fcasts = x11.fcasts, x11.bcasts = x11.bcasts, + x11.calendarSigma = x11.calendarSigma, x11.sigmaVector = x11.sigmaVector, + x11.excludeFcasts = x11.excludeFcasts) + benchmarking <- benchmarking_spec( + spec = spec, + benchmarking.enabled = benchmarking.enabled, + benchmarking.target = benchmarking.target, + benchmarking.useforecast = benchmarking.useforecast, + benchmarking.rho = benchmarking.rho, + benchmarking.lambda = benchmarking.lambda) + z <- list(regarima = regarima, x11 = x11, benchmarking = benchmarking) class(z) <- c("SA_spec", "X13") return(z) } diff --git a/README.Rmd b/README.Rmd index 7d32675..2195a82 100644 --- a/README.Rmd +++ b/README.Rmd @@ -4,7 +4,7 @@ output: github_document -```{r, echo = FALSE} +```{r, echo = FALSE, include=FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", @@ -17,16 +17,16 @@ options(enable_print_style = FALSE) # RJDemetra -[![R-CMD-check](https://github.com/jdemetra/rjdemetra/workflows/R-CMD-check/badge.svg)](https://github.com/jdemetra/rjdemetra/actions) -[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/RJDemetra)](https://cran.r-project.org/package=RJDemetra) -[![CRAN last release](http://www.r-pkg.org/badges/last-release/RJDemetra)](https://cran.r-project.org/package=RJDemetra) -[![CRAN monthly downloads](http://cranlogs.r-pkg.org/badges/RJDemetra?color=lightgrey)](https://cran.r-project.org/package=RJDemetra) -[![CRAN downloads](http://cranlogs.r-pkg.org/badges/grand-total/RJDemetra?color=lightgrey)](https://cran.r-project.org/package=RJDemetra) +[![R-CMD-check](https://github.com/rjdverse/rjdemetra/workflows/R-CMD-check/badge.svg)](https://github.com/rjdverse/rjdemetra/actions) +[![R universe version](https://rjdverse.r-universe.dev/badges/RJDemetra)](https://rjdverse.r-universe.dev/RJDemetra) +[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/RJDemetra)](https://cran.r-project.org/package=RJDemetra) +[![CRAN last release](https://www.r-pkg.org/badges/last-release/RJDemetra)](https://cran.r-project.org/package=RJDemetra) +[![CRAN monthly downloads](https://cranlogs.r-pkg.org/badges/RJDemetra?color=lightgrey)](https://cran.r-project.org/package=RJDemetra) +[![CRAN downloads](https://cranlogs.r-pkg.org/badges/grand-total/RJDemetra?color=lightgrey)](https://cran.r-project.org/package=RJDemetra) [![Mentioned in Awesome Official Statistics ](https://awesome.re/mentioned-badge.svg)](https://github.com/SNStatComp/awesome-official-statistics-software) RJDemetra is an R interface to JDemetra+, the seasonal adjustment software [officially recommended](https://wayback.archive-it.org/12090/20240102173448/https://cros-legacy.ec.europa.eu/system/files/Jdemetra_%20release.pdf) to the members of the European Statistical System (ESS) and the European System of Central Banks. JDemetra+ implements the two leading seasonal adjustment methods [TRAMO/SEATS+](https://gretl.sourceforge.net/tramo/tramo-seats.html) and [X-12ARIMA/X-13ARIMA-SEATS](https://www.census.gov/data/software/x13as.html). - Besides seasonal adjustment, JDemetra+ bundles other time series models that are useful in the production or analysis of economic statistics, including for instance outlier detection, nowcasting, temporal disaggregation or benchmarking. For more details on the JDemetra+ software see . @@ -35,19 +35,30 @@ RJDemetra offers full access to all options and outputs of JDemetra+. ## Installation -RJDemetra relies on the [rJava](https://CRAN.R-project.org/package=rJava) package and Java SE version between 8 and 15 is required. +RJDemetra relies on the [rJava](https://CRAN.R-project.org/package=rJava) package and Java SE version 8 or higher is required. ```{r, eval = FALSE} # Install release version from CRAN install.packages("RJDemetra") +``` + +To install the developpment version: + +- From [r-universe](https://rjdverse.r-universe.dev/RJDemetra): + +```{r, echo = TRUE, eval = FALSE} +install.packages("RJDemetra", repos = c("https://rjdverse.r-universe.dev", "https://cloud.r-project.org")) +``` + +- From GitHub: -# Install development version from GitHub -# install.packages("devtools") -devtools::install_github("jdemetra/rjdemetra") +```{r, echo = TRUE, eval = FALSE} +# install.packages("remotes") +remotes::install_github("rjdverse/rjdemetra") ``` -If you have troubles with the installation, check the [installation manual](https://github.com/jdemetra/rjdemetra/wiki/Installation-manual). +If you have troubles with the installation, check the [installation manual](https://github.com/rjdverse/rjdemetra/wiki/Installation-manual). ## Basic example diff --git a/README.md b/README.md index c4fc4d4..1c4773c 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,16 @@ # RJDemetra -[![R-CMD-check](https://github.com/jdemetra/rjdemetra/workflows/R-CMD-check/badge.svg)](https://github.com/jdemetra/rjdemetra/actions) -[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/RJDemetra)](https://cran.r-project.org/package=RJDemetra) +[![R-CMD-check](https://github.com/rjdverse/rjdemetra/workflows/R-CMD-check/badge.svg)](https://github.com/rjdverse/rjdemetra/actions) +[![R universe +version](https://rjdverse.r-universe.dev/badges/RJDemetra)](https://rjdverse.r-universe.dev/RJDemetra) +[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/RJDemetra)](https://cran.r-project.org/package=RJDemetra) [![CRAN last -release](http://www.r-pkg.org/badges/last-release/RJDemetra)](https://cran.r-project.org/package=RJDemetra) +release](https://www.r-pkg.org/badges/last-release/RJDemetra)](https://cran.r-project.org/package=RJDemetra) [![CRAN monthly -downloads](http://cranlogs.r-pkg.org/badges/RJDemetra?color=lightgrey)](https://cran.r-project.org/package=RJDemetra) +downloads](https://cranlogs.r-pkg.org/badges/RJDemetra?color=lightgrey)](https://cran.r-project.org/package=RJDemetra) [![CRAN -downloads](http://cranlogs.r-pkg.org/badges/grand-total/RJDemetra?color=lightgrey)](https://cran.r-project.org/package=RJDemetra) +downloads](https://cranlogs.r-pkg.org/badges/grand-total/RJDemetra?color=lightgrey)](https://cran.r-project.org/package=RJDemetra) [![Mentioned in Awesome Official Statistics](https://awesome.re/mentioned-badge.svg)](https://github.com/SNStatComp/awesome-official-statistics-software) @@ -37,19 +39,30 @@ RJDemetra offers full access to all options and outputs of JDemetra+. RJDemetra relies on the [rJava](https://CRAN.R-project.org/package=rJava) package and Java SE -version between 8 and 15 is required. +version 8 or higher is required. ``` r # Install release version from CRAN install.packages("RJDemetra") +``` + +To install the developpment version: + +- From [r-universe](https://rjdverse.r-universe.dev/RJDemetra): + +``` r +install.packages("RJDemetra", repos = c("https://rjdverse.r-universe.dev", "https://cloud.r-project.org")) +``` -# Install development version from GitHub -# install.packages("devtools") -devtools::install_github("jdemetra/rjdemetra") +- From GitHub: + +``` r +# install.packages("remotes") +remotes::install_github("rjdverse/rjdemetra") ``` If you have troubles with the installation, check the [installation -manual](https://github.com/jdemetra/rjdemetra/wiki/Installation-manual). +manual](https://github.com/rjdverse/rjdemetra/wiki/Installation-manual). ## Basic example diff --git a/_pkgdown.yml b/_pkgdown.yml index ac509c2..5a337c6 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -47,7 +47,7 @@ navbar: href: https://github.com/InseeFrLab/rjdworkspace github: icon: fa-github fa-lg - href: https://github.com/jdemetra/rjdemetra + href: https://github.com/rjdverse/rjdemetra reference: - title: Seasonal adjustment functions diff --git a/inst/java/demetra-tstoolkit-2.2.3.jar b/inst/java/demetra-tstoolkit-2.2.3.jar deleted file mode 100644 index 55ed5fd..0000000 Binary files a/inst/java/demetra-tstoolkit-2.2.3.jar and /dev/null differ diff --git a/inst/java/demetra-tstoolkit-2.2.5.jar b/inst/java/demetra-tstoolkit-2.2.5.jar new file mode 100644 index 0000000..90acff8 Binary files /dev/null and b/inst/java/demetra-tstoolkit-2.2.5.jar differ diff --git a/inst/java/jdr-2.2.4.jar b/inst/java/jdr-2.2.4.jar index 47b96b7..1a3bd43 100644 Binary files a/inst/java/jdr-2.2.4.jar and b/inst/java/jdr-2.2.4.jar differ diff --git a/java/README b/java/README index 0fab969..90d9a75 100644 --- a/java/README +++ b/java/README @@ -1,4 +1,4 @@ RJDemetra sources can be obtained from GitHub: -- RJDemetra R Package: https://github.com/jdemetra/rjdemetra +- RJDemetra R Package: https://github.com/rjdverse/rjdemetra - JDemetra Java Sources: https://github.com/nbbrd/jdemetra-sa-advanced (jdr) and https://github.com/jdemetra/jdemetra-core (jtstoolkit) diff --git a/man/figures/logo.png b/man/figures/logo.png index 660e56d..c992cc0 100644 Binary files a/man/figures/logo.png and b/man/figures/logo.png differ diff --git a/man/figures/logo.svg b/man/figures/logo.svg index bc1b5d7..1ded25a 100644 --- a/man/figures/logo.svg +++ b/man/figures/logo.svg @@ -17,7 +17,7 @@ version="1.1" inkscape:version="0.92.0 r15299" sodipodi:docname="logo.svg" - inkscape:export-filename="D:\ZW20hj\Mes Documents\rjdemetra_perso\man\figures\rjdemetra.png" + inkscape:export-filename="rjdemetra.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> github.com/jdemetra/rjdemetra + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:25px;line-height:25px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#00006d;fill-opacity:1">github.com/rjdverse/rjdemetra