Skip to content

Commit

Permalink
Merge pull request #20 from rjdemetra/develop
Browse files Browse the repository at this point in the history
v3.2.0
  • Loading branch information
palatej authored Nov 24, 2023
2 parents f6d3c3e + 477bb44 commit df5e9af
Show file tree
Hide file tree
Showing 23 changed files with 145 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
56 changes: 56 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [develop]
pull_request:
branches: [develop]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Set up for RProtoBuf
run: sudo apt-get update -y && sudo apt-get install protobuf-compiler libprotobuf-dev libprotoc-dev

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
.Rhistory
.RData
.Ruserdata

TO_DO
docs
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rjd3toolkit
Type: Package
Title: Toolkit Functions Around 'JDemetra+ 3.0'
Version: 3.1.0
Version: 3.2.0
Authors@R: c(
person("Jean", "Palate", role = c("aut", "cre"),
email = "[email protected]"),
Expand All @@ -21,7 +21,7 @@ Imports:
methods
SystemRequirements: Java (>= 17)
License: EUPL
URL: https://github.com/rjdemetra/rjd3toolkit
URL: https://github.com/rjdemetra/rjd3toolkit, https://rjdemetra.github.io/rjd3toolkit/
LazyData: TRUE
Suggests:
knitr,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export(add_ramp)
export(add_usrdefvar)
export(aggregate)
export(ao_variable)
export(arima_difference)
export(arima_model)
export(arima_properties)
export(arima_sum)
Expand Down
26 changes: 25 additions & 1 deletion R/arima.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,30 @@ arima_lsum<-function(components){
return (.jd2r_arima(jsum))
}

#' Remove an arima model from an existing one
#'
#' @param left Left operand
#' @param right Right operand
#' @param simplify Simplify the results
#'
#' @return a `"JD3_ARIMA"` model.
#' @export
#'
#' @details
#'
#' @examples
#' mod1 = arima_model(delta = c(1,-2,1))
#' mod2 = arima_model(variance=.01)
#' diff<- arima_difference(mod1, mod2)
#'
arima_difference<-function(left, right, simplify=TRUE){
jleft<-.r2jd_arima(left)
jright<-.r2jd_arima(right)
jdiff<-.jcall(jleft, "Ljdplus/toolkit/base/core/arima/ArimaModel;", "minus", jright, as.logical(simplify))
return (.jd2r_arima(jdiff))
}


#' ARIMA Properties
#'
#' @param model a `"JD3_ARIMA"` model (created with [arima_model()]).
Expand Down Expand Up @@ -291,7 +315,7 @@ ucarima_canonical<-function(ucm, cmp=0, adjust=TRUE){
#' @examples
ucarima_estimate<-function(x, ucm, stdev=TRUE){
jucm<-.r2jd_ucarima(ucm)
jcmps<-.jcall("jdplus/toolkit/base/r/arima/UcarimaModels", "Ljdplus/toolkit/base/core/math/matrices/Matrix;", "estimate",
jcmps<-.jcall("jdplus/toolkit/base/r/arima/UcarimaModels", "Ljdplus/toolkit/base/api/math/matrices/Matrix;", "estimate",
as.numeric(x), jucm, as.logical(stdev))
return (.jd2r_matrix(jcmps))
}
Expand Down
14 changes: 8 additions & 6 deletions R/tests_seasonality.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,17 @@ seasonality_f<-function(data,
#' "X12" Test On Seasonality
#'
#' @inheritParams seasonality_qs
#' @param firstperiod First period of the series (1-based)
#' @param firstperiod Position in a cycle of the first obs.
#' For example, for a monthly, `firstperiod = 1` means January.
#' If `data` is not a `"ts"` object, `firstperiod = 1` by default.
#' @param mul boolean indicating if the seasonal decomposition is multiplicative (`mul = TRUE`) or additive (`mul = FALSE`).
#' @details Combined test on the presence of identifiable seasonality (see Ladiray and Quenneville, 1999).
#' @export
#'
#' @examples
#' seasonality_combined(ABS$X0.2.09.10.M, 12)
#' seasonality_combined(random_t(2, 1000), 7)
seasonality_combined<-function(data, period, firstperiod=1, mul=TRUE){
seasonality_combined<-function(data, period, firstperiod=cycle(data)[1], mul=TRUE){
if (is.ts(data) & missing(period))
period <- frequency(data)
jctest<-.jcall("jdplus/sa/base/r/SeasonalityTests", "Ljdplus/sa/base/core/tests/CombinedSeasonality;", "combinedTest",
Expand All @@ -134,10 +136,10 @@ seasonality_combined<-function(data, period, firstperiod=1, mul=TRUE){
#' Seasonal Canova-Hansen test
#'
#' @inheritParams seasonality_qs
#' @param p0 Initial periodicity (included)
#' @param p1 Final periodicity (included)
#' @param np Number of periodicities equally spaced in $\[p0,p1\]$
#' @param original True for original algorithm, False for solution proposed by T. Proietti (based on Ox code)
#' @param p0 Initial periodicity (included).
#' @param p1 Final periodicity (included).
#' @param np Number of periodicities equally spaced in \eqn{[p_0,p_1]}.
#' @param original `TRUE` for original algorithm, `FALSE` for solution proposed by T. Proietti (based on Ox code).
#'
#' @export
#'
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# rjd3toolkit
Basic package around jdemetra+ 3.x
Basic package around JDemetra+ 3.x

## Installation

To get the current stable version (from the latest release):

``` r
# install.packages("remotes")
remotes::install_github("rjdemetra/rjd3toolkit@*release")
```

To get the current development version from GitHub:

``` r
# Install development version from GitHub
# install.packages("remotes")
remotes::install_github("rjdemetra/rjd3toolkit")
```
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
url: https://rjdemetra.github.io/rjd3toolkit/
template:
bootstrap: 5

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed inst/java/jdplus-toolkit-base-protobuf-3.1.0.jar
Binary file not shown.
Binary file added inst/java/jdplus-toolkit-base-protobuf-3.2.0.jar
Binary file not shown.
Binary file not shown.
Binary file removed inst/java/protobuf-java-3.24.4.jar
Binary file not shown.
Binary file added inst/java/protobuf-java-3.25.1.jar
Binary file not shown.
27 changes: 27 additions & 0 deletions man/arima_difference.Rd

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

8 changes: 4 additions & 4 deletions man/seasonality_canovahansen.Rd

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

6 changes: 4 additions & 2 deletions man/seasonality_combined.Rd

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

0 comments on commit df5e9af

Please sign in to comment.