Skip to content

Commit

Permalink
Merge pull request #6 from AQLT/develop
Browse files Browse the repository at this point in the history
Correction of some typos
  • Loading branch information
palatej authored Oct 2, 2023
2 parents cd544a8 + b7f1526 commit aa465a9
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 31 deletions.
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ export(remove_outlier)
export(remove_ramp)
export(result)
export(sa.decomposition)
export(sa.preprocessing)
export(sa_decomposition)
export(sa_preprocessing)
export(sadecomposition)
export(sarima_decompose)
export(sarima_estimate)
Expand Down
19 changes: 18 additions & 1 deletion R/arima.R
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,24 @@ sarima_estimate<-function(x, order=c(0,0,0), seasonal = list(order=c(0,0,0), per
bytes<-.jcall("jdplus/toolkit/base/r/arima/SarimaModels", "[B", "toBuffer", jestim)
p<-RProtoBuf::read(regarima.RegArimaModel$Estimation, bytes)
res <- .p2r_regarima_estimation(p)
names(res$b) <- colnames(xreg)

if (length(res$b) > 0) {

names_xreg <- colnames(xreg)
if (is.null (names_xreg) & !is.null (xreg)){
if (is.matrix(xreg)) {
# unnamed matrix regressors
names_xreg <- sprintf("xreg_%i", seq_len(ncol(xreg)))
} else {
# vector external regressor
names_xreg <- "xreg_1"
}
}
if (mean) {
names_xreg <- c("intercept", names_xreg)
}
names(res$b) <- names_xreg
}
names(res$parameters$val) <- c(sprintf("phi(%i)", seq_len(order[1])),
sprintf("bphi(%i)", seq_len(seasonal$order[1])),
sprintf("theta(%i)", seq_len(order[3])),
Expand Down
6 changes: 3 additions & 3 deletions R/decomposition.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
NULL


#' @rdname sa.decomposition
#' @rdname sa_decomposition
#' @export
sadecomposition<-function(y, sa, t, s, i, mul){
if (! is.logical(mul))stop("Invalid SA decomposition")
Expand Down Expand Up @@ -33,7 +33,7 @@ sadecomposition<-function(y, sa, t, s, i, mul){
return (structure(list(series=y, sa=sa, trend=t, seas=s, irr=i, multiplicative=mul), class=c("JD3_SADECOMPOSITION", "JD3")))
}

#' @rdname sa.decomposition
#' @rdname sa_decomposition
#' @export
print.JD3_SADECOMPOSITION<-function(x, n_last_obs = frequency(x$series), ...){
cat("Last values\n")
Expand All @@ -43,7 +43,7 @@ print.JD3_SADECOMPOSITION<-function(x, n_last_obs = frequency(x$series), ...){
)
)
}
#' @rdname sa.decomposition
#' @rdname sa_decomposition
#' @export
plot.JD3_SADECOMPOSITION <- function(x, first_date = NULL, last_date = NULL,
type_chart = c("sa-trend", "seas-irr"),
Expand Down
28 changes: 21 additions & 7 deletions R/generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#'
#' @export
diagnostics<-function(x, ...){
UseMethod("diagnostics")
UseMethod("diagnostics", x)
}


Expand All @@ -24,15 +24,15 @@ diagnostics.JD3<-function(x, ...){
#' @param x,... parameters.
#'
#' @export
sa.preprocessing<-function(x, ...){
UseMethod("sa.preprocessing")
sa_preprocessing<-function(x, ...){
UseMethod("sa_preprocessing", x)
}


#' Generic Function for Seasonal Adjustment Decomposition
#'
#' Generic function to format the seasonal adjustment decomposition components.
#' \code{sa.decomposition()} is a generic function defined in other packages.
#' \code{sa_decomposition()} is a generic function defined in other packages.
#'
#' @param y,sa,t,s,i,mul seasonal adjustment decomposition parameters.
#' @param x the object to print.
Expand All @@ -45,11 +45,25 @@ sa.preprocessing<-function(x, ...){
#' @param ... further arguments.
#'
#' @return \code{"JD3_SADECOMPOSITION"} object.
#' @name sa.decomposition
#' @name sa_decomposition
NULL

#' @export
#' @rdname sa.decomposition
#' @rdname sa_decomposition
sa_decomposition<-function(x, ...){
UseMethod("sa_decomposition", x)
}

#' Deprecated functions
#'
#' @description
#' Use [sa_decomposition()] instead of `sa.decomposition()`.
#'
#' @inheritParams sa_decomposition
#' @name deprecated-rjd3toolkit
#' @export
#' @export
sa.decomposition<-function(x, ...){
UseMethod("sa.decomposition")
.Deprecated("sa_decomposition")
UseMethod("sa_decomposition", x)
}
4 changes: 2 additions & 2 deletions R/regarima_generic.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ vcov.JD3_REGARIMA_RSLTS <- function(object, component = c("regression", "arima")
return(NULL)
component <- match.arg(component)
if (component == "regression") {
object$estimation$parameters$cov
object$bvar
} else {
object$estimation$bvar
object$parameters$cov
}
}
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/tests_td.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ NULL
#' }
#' \item \code{model = "R011"} the following model is used:
#' \deqn{
#' y_t =\beta TD_t + \varepsilon_t \text{ with }\varepsilon_t \sim ARIMA(0,1,1)(0,1,1)
#' y_t =\beta TD_t + \varepsilon_t \text{ with }\varepsilon_t \sim ARIMA(0,1,1)
#' }
#' \item \code{model = "R100"} the following model is used:
#' \deqn{
Expand Down
17 changes: 17 additions & 0 deletions man/deprecated-rjd3toolkit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/sa.decomposition.Rd → man/sa_decomposition.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/sa.preprocessing.Rd → man/sa_preprocessing.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/td_f.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions vignettes/calendar_correction_functions.R

This file was deleted.

0 comments on commit aa465a9

Please sign in to comment.