-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v3.1.0
- Loading branch information
Showing
29 changed files
with
496 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^README\.Rmd$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: rjd3x13 | ||
Type: Package | ||
Title: Seasonal Adjustment with X-13 and 'JDemetra+ 3.0' | ||
Version: 3.0.0 | ||
Version: 3.1.0 | ||
Authors@R: c( | ||
person("Jean", "Palate", role = c("aut", "cre"), | ||
email = "[email protected]"), | ||
|
@@ -15,7 +15,7 @@ Depends: | |
R (>= 3.6.0) | ||
Imports: | ||
rJava (>= 1.0-6), | ||
rjd3toolkit (>= 3.0.0), | ||
rjd3toolkit (>= 3.1.0), | ||
RProtoBuf (>= 0.4.17) | ||
SystemRequirements: Java (>= 17) | ||
License: EUPL | ||
|
@@ -25,14 +25,16 @@ Roxygen: list(markdown = TRUE) | |
BugReports: https://github.com/rjdemetra/rjd3x13/issues | ||
Encoding: UTF-8 | ||
Collate: | ||
'deprecated.R' | ||
'print.R' | ||
'regarima_generic.R' | ||
'utils.R' | ||
'regarima_outliers.R' | ||
'regarima_spec.R' | ||
'set_x11_spec.R' | ||
'udvar.R' | ||
'x13_rslts.R' | ||
'x13_spec.R' | ||
'revisions.R' | ||
'set_x11_spec.R' | ||
'udvar.R' | ||
'x13.R' | ||
'zzz.R' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#' Deprecated functions | ||
#' | ||
#' | ||
#' @param ts,spec,context,userdefined,name Parameters. | ||
#' @name deprecated-rjd3x13 | ||
#' @export | ||
spec_x13<-function(name = c("rsa4","rsa0", "rsa1", "rsa2c", "rsa3", "rsa5c")){ | ||
.Deprecated("x13_spec") | ||
x13_spec(name) | ||
} | ||
#' @name deprecated-rjd3x13 | ||
#' @export | ||
spec_regarima<-function(name=c("rg4","rg0", "rg1", "rg2c", "rg3", "rg5c")){ | ||
.Deprecated("regarima_spec") | ||
regarima_spec(name) | ||
} | ||
#' @name deprecated-rjd3x13 | ||
#' @export | ||
spec_x11 <- function() { | ||
.Deprecated("x11_spec") | ||
x11_spec() | ||
} | ||
#' @name deprecated-rjd3x13 | ||
#' @export | ||
fast_x13<-function(ts, spec=c("rsa4", "rsa0", "rsa1", "rsa2c", "rsa3", "rsa5c"), context=NULL, userdefined = NULL){ | ||
.Deprecated("x13_fast") | ||
x13_fast(ts, spec, context, userdefined) | ||
} | ||
#' @name deprecated-rjd3x13 | ||
#' @export | ||
fast_regarima<-function(ts, spec= c("rg4", "rg0", "rg1", "rg2c", "rg3","rg5c"), context=NULL, userdefined = NULL){ | ||
.Deprecated("regarima_fast") | ||
regarima_fast(ts, spec, context, userdefined) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#' @include utils.R x13_spec.R x13_rslts.R | ||
NULL | ||
|
||
.jrevisions<-function(jts, jspec, jcontext){ | ||
jrslt<-.jcall("jdplus/x13/base/r/X13RevisionHistory", | ||
"Ljdplus/toolkit/base/r/timeseries/Revisions;", "revisions", jts, jspec, jcontext) | ||
return (jrslt) | ||
} | ||
|
||
|
||
#' Revisions History | ||
#' | ||
#' Compute revisions history | ||
#' | ||
#' @param ts The time series used for the estimation. | ||
#' @param spec The specification used. | ||
#' @param data_ids A `list` of `list` to specify the statistics to export. | ||
#' Each sub-list must contain two elements: | ||
#' `start` (first date to compute the history, in the format `"YYYY-MM-DD"`) | ||
#' and `id` (the name of the statistics, see [x13_dictionary()]). | ||
#' See example. | ||
#' @param ts_ids A `list` of `list` to specify the specific date of a component whose history is to be studied. | ||
#' Each sub-list must contain three elements: | ||
#' `start` (first date to compute the history, in the format `"YYYY-MM-DD"`), | ||
#' `period` (the date of the studied) | ||
#' and `id` (the name of the component, see [x13_dictionary()]). | ||
#' See example. | ||
#' @param cmp_ids A `list` of `list` to specify the component whose history is to be studied. | ||
#' Each sub-list must contain three elements: | ||
#' `start` (first date to compute the history, in the format `"YYYY-MM-DD"`), | ||
#' `end` (last date to compute the history, in the format `"YYYY-MM-DD"`) | ||
#' and `id` (the name of the component, see [x13_dictionary()]). | ||
#' As many series as periods between `start` and `end` will be exported. | ||
#' See example. | ||
#' @param context The context of the specification. | ||
#' | ||
#' @examples | ||
#' s <- rjd3toolkit::ABS$X0.2.09.10.M | ||
#' sa_mod <- x13(s) | ||
#' data_ids <- list( | ||
#' # Get the coefficient of the trading-day coefficient from 2005-jan | ||
#' list(start = "2005-01-01", id = "regression.td(1)"), | ||
#' # Get the ljung-box statistics on residuals from 2010-jan | ||
#' list(start = "2010-01-01", id = "residuals.lb")) | ||
#' ts_ids <- list( | ||
#' # Get the SA component estimates of 2010-jan from 2010-jan | ||
#' list(period = "2010-01-01", start = "2010-01-01", id = "sa"), | ||
#' # Get the irregular component estimates of 2010-jan from 2015-jan | ||
#' list(period = "2010-01-01", start = "2015-01-01", id = "i")) | ||
#' cmp_ids <- list( | ||
#' # Get the SA component estimates (full time series) 2010-jan to 2020-jan | ||
#' list(start = "2010-01-01", end = "2020-01-01", id = "sa"), | ||
#' # Get the trend component estimates (full time series) 2010-jan to 2020-jan | ||
#' list(start = "2010-01-01", end = "2020-01-01", id = "t")) | ||
#' rh <- x13_revisions(s, sa_mod$result_spec, data_ids, ts_ids, cmp_ids) | ||
#' @export | ||
x13_revisions<-function(ts, spec, data_ids=NULL, ts_ids=NULL, cmp_ids=NULL, context=NULL){ | ||
jts<-rjd3toolkit::.r2jd_tsdata(ts) | ||
jspec<-.r2jd_spec_x13(spec) | ||
if (is.null(context)){ | ||
jcontext <- .jnull("jdplus/toolkit/base/api/timeseries/regression/ModellingContext") | ||
} else { | ||
jcontext <- rjd3toolkit::.r2jd_modellingcontext(context) | ||
} | ||
ldata<-NULL | ||
jr<-.jrevisions(jts, jspec, jcontext) | ||
if (! is.null(data_ids)){ | ||
ldata<-lapply(data_ids, function(data_id){ | ||
w<-.jcall(jr, "Ljdplus/toolkit/base/api/timeseries/TsData;", "history", data_id$id, data_id$start) | ||
return (rjd3toolkit::.jd2r_tsdata(w)) | ||
}) | ||
names(ldata) <- sapply(data_ids, `[[`,"id") | ||
} | ||
lts<-NULL | ||
if (! is.null(ts_ids)){ | ||
lts<-lapply(ts_ids, function(ts_id){ | ||
w<-.jcall(jr, "Ljdplus/toolkit/base/api/timeseries/TsData;", "tsHistory", ts_id$id, ts_id$period, ts_id$start) | ||
return (rjd3toolkit::.jd2r_tsdata(w)) | ||
}) | ||
names(lts) <- sapply(ts_ids, `[[`,"id") | ||
} | ||
lcmp<-NULL | ||
if (! is.null(cmp_ids)){ | ||
lcmp<-lapply(cmp_ids, function(cmp_id){ | ||
w<-.jcall(jr, "Ljdplus/toolkit/base/api/timeseries/TsDataTable;", "tsSelect", cmp_id$id, cmp_id$start, cmp_id$end) | ||
return (rjd3toolkit::.jd2r_mts(w)) | ||
}) | ||
names(lcmp) <- sapply(cmp_ids, `[[`,"id") | ||
} | ||
|
||
return (list(data=ldata, series=lts, components=lcmp)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.