37
useR! 2019 RJDemetra: an R interface to JDemetra+ Alain Quartier-la-Tente Insee, Seasonal Adjustment Centre of Excellence (SACE) [email protected]

RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

useR! 2019

RJDemetra: an R interface to JDemetra+

Alain Quartier-la-TenteInsee, Seasonal Adjustment Centre of Excellence (SACE)[email protected]

Page 2: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Introduction to seasonal adjustment (SA)

Sommaire

1. Introduction to seasonal adjustment (SA)

2. RJDemetra

3. Around RJDemetra and JDemetra+

4. Installation and future developments

1 / 33

Page 3: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Introduction to seasonal adjustment (SA)

Introduction to SA with a boring example?

75

80

85

90

95

100

105

110

115

2012 2014 2016

Dat

e

Figure 1: Industrial production index in France

2 / 33

Page 4: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Introduction to seasonal adjustment (SA)

Introduction to SA with an ^ example

200

400

600

800

2016 2017 2018 2019

Mon

thly

dow

nloa

ds (

/100

0)

ggplot2

Figure 2: Monthly CRAN downloads of ggplot2

3 / 33

Page 5: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Introduction to seasonal adjustment (SA)

Introduction to trading days adjustment

Weekday CRAN downloadsMonday 40217Tuesday 42991

Wednesday 44177Thursday 41672Friday 35544

Saturday 15481Sunday 16081

Table 1: Total CRAN downloads of officer per weekday since 2017-03

4 / 33

Page 6: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Introduction to seasonal adjustment (SA)

Why and how perform seasonal adjustment?

Purpose of seasonal adjustment: analyse the CRAN downloads of yourpackage but also. . .• Time comparison (outlook, short-term evolution. . . )• Spatial comparison

Two leading methods:• TRAMO/SEATS+ (Bank of Spain)• X-12ARIMA/X-13ARIMA-SEATS (US-Census Bureau).

→ proceed in two steps:

1. Pre-adjusting the series of deterministics effects with a RegARIMA model

2. Decomposition: to extract seasonal component

5 / 33

Page 7: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Introduction to seasonal adjustment (SA)

Why and how perform seasonal adjustment?

Purpose of seasonal adjustment: analyse the CRAN downloads of yourpackage but also. . .• Time comparison (outlook, short-term evolution. . . )• Spatial comparison

Two leading methods:• TRAMO/SEATS+ (Bank of Spain)• X-12ARIMA/X-13ARIMA-SEATS (US-Census Bureau).

→ proceed in two steps:

1. Pre-adjusting the series of deterministics effects with a RegARIMA model

2. Decomposition: to extract seasonal component

5 / 33

Page 8: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Introduction to seasonal adjustment (SA)

Why and how perform seasonal adjustment?

Purpose of seasonal adjustment: analyse the CRAN downloads of yourpackage but also. . .• Time comparison (outlook, short-term evolution. . . )• Spatial comparison

Two leading methods:• TRAMO/SEATS+ (Bank of Spain)• X-12ARIMA/X-13ARIMA-SEATS (US-Census Bureau).

→ proceed in two steps:

1. Pre-adjusting the series of deterministics effects with a RegARIMA model

2. Decomposition: to extract seasonal component

5 / 33

Page 9: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Introduction to seasonal adjustment (SA)

What’s JDemetra+

TRAMO/SEATS+ and X-13ARIMA-SEATS are implementedin JDemetra+ (JD+)

� Software officially recommended by Eurostat and the ECB for seasonaland calendar adjustment of official statistics

→ RJDemetra is an ^ interface to JDemetra+ based on the K libraries ofJD+

6 / 33

Page 10: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra

Sommaire

1. Introduction to seasonal adjustment (SA)

2. RJDemetra

2.1 Current status

2.2 RegARIMA examples

2.3 Seasonal adjustment examples

2.4 Export a JD+ workspace

2.5 Import a JD+ workspace

2.6 Reduce time computation

3. Around RJDemetra and JDemetra+

4. Installation and future developments7 / 33

Page 11: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Current status

Current status

• RegARIMA, TRAMO-SEATS and X-13-ARIMA:◦ pre-defined and user-defined specifications: outliers detection, ARIMA

detection, userdefined regressors, transformation function. . .◦ S3 classes with plot, summary, print methods

• Manipulate JD+ workspaces:◦ Import JD+ workspace to get input raw series or SA model◦ Export R models created via RJDemetra

• Include a dataset: industrial production indices in manufacturing in theEuropean Union

8 / 33

Page 12: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Current status

Object structure

A SA object is a list() of 5 elements:

9 / 33

Page 13: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Current status

Create your first model

Like in JD+ users can defined their own specification or use a pre-definedone:library(RJDemetra)ipi_fr <- ipi_c_eu[, "FR"]ts_mod <- tramoseats(ipi_fr, spec = "RSAfull")x13_usr_spec <- x13_spec(spec = c("RSA5c"),

usrdef.outliersEnabled = TRUE,usrdef.outliersType = c("LS", "AO"),usrdef.outliersDate = c("2008-10-01",

"2002-01-01"),usrdef.outliersCoef = c(36, 14),transform.function = "None")

x13_mod <- x13(ipi_fr, x13_usr_spec, userdefined = "diagnostics.ic-ratio")

Use user_defined_variables() to get the names of the user-defined variables

10 / 33

Page 14: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra RegARIMA examples

RegARIMA examples (1/2)summary(x13_mod$regarima)

## y = regression model + arima (0, 1, 1, 0, 1, 1)#### Model: RegARIMA - X13## Estimation span: from 1-1990 to 12-2017## Log-transformation: no## Regression model: no mean, no trading days effect, no leap year effect, Easter effect, outliers(7)#### Coefficients:## ARIMA:## Estimate Std. Error T-stat Pr(>|t|)## Theta(1) -0.53675 0.04770 -11.25 <2e-16 ***## BTheta(1) -0.50830 0.04961 -10.25 <2e-16 ***## ---## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1#### Regression model:## Estimate Std. Error T-stat Pr(>|t|)## Easter [1] -1.1686 0.3385 -3.452 0.000629 ***## AO (9-2008) 31.4099 2.1812 14.400 < 2e-16 ***## LS (9-2008) -56.6477 2.2561 -25.109 < 2e-16 ***## TC (9-2008) 24.1814 3.2563 7.426 1.00e-12 ***## LS (2-2002) 14.7081 1.5257 9.640 < 2e-16 ***## LS (12-2001) -14.6482 1.6811 -8.714 < 2e-16 ***## AO (12-2001) 13.0297 1.7312 7.527 5.23e-13 ***## LS (5-2008) -5.4848 1.2957 -4.233 3.01e-05 ***## ---## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1## Coefficients## LS (10-2008) 36## AO (1-2002) 14###### Residual standard error: 1.729 on 11 degrees of freedom## Log likelihood = -637.1, aic = 1296, aicc = 1297, bic(corrected for length) = 1.274

11 / 33

Page 15: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra RegARIMA examples

RegARIMA examples (2/2)layout(matrix(1:6, 3, 2));plot(x13_mod$regarima, ask = FALSE)

Time

Res

idua

ls

1995 2000 2005 2010 2015

−6

−2

26

Residuals

Standardized residuals

Den

sity

−4 −2 0 2 4

0.0

0.2

0.4

Histogram of residuals

−3 −2 −1 0 1 2 3

−2

24

Theoretical Quantiles

Sta

ndar

dize

d re

sidu

als Normal Q−Q

−0.

150.

00

Lag

AC

F

0 6 12 18 24 30 36

ACF of residuals

−0.

150.

00

Lag

Par

tial A

CF

0 6 12 18 24 30 36

PACF of residuals

Time

1990 1995 2000 2005 2010 2015

4080

120

y linearisedy (= y lin. + cal. + out.)

Decomposition

12 / 33

Page 16: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Seasonal adjustment examples

Seasonal adjustment examples (1/7): decompositionx13_mod$decomposition

## Monitoring and Quality Assessment Statistics:## M stats## M(1) 0.055## M(2) 0.041## M(3) 0.926## M(4) 0.621## M(5) 0.724## M(6) 0.215## M(7) 0.074## M(8) 0.208## M(9) 0.056## M(10) 0.158## M(11) 0.146## Q 0.297## Q-M2 0.329#### Final filters:## Seasonal filter: 3x5## Trend filter: 13 terms Henderson moving average

13 / 33

Page 17: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Seasonal adjustment examples

Seasonal adjustment examples (2/7): decompositionts_mod$decomposition

## Model## AR : 1 + 0.352498 B + 0.133616 B^2## D : 1 - B - B^12 + B^13## MA : 1 - 0.186819 B - 0.610856 B^12 + 0.114119 B^13###### SA## D : 1 - 2.000000 B + B^2## MA : 1 - 1.314459 B + 0.340427 B^2## Innovation variance: 0.4669153#### Trend## D : 1 - 2.000000 B + B^2## MA : 1 + 0.040206 B - 0.959794 B^2## Innovation variance: 0.04869563#### Seasonal## AR : 1 + 0.352498 B + 0.133616 B^2## D : 1 + B + B^2 + B^3 + B^4 + B^5 + B^6 + B^7 + B^8 + B^9 + B^10 + B^11## MA : 1 + 0.717848 B + 0.460721 B^2 + 0.310085 B^3 + 0.132447 B^4 - 0.049053 B^5 - 0.216655 B^6 - 0.354556 B^7 - 0.445030 B^8 - 0.469587 B^9 - 0.376625 B^10 - 0.166397 B^11 - 0.410618 B^12 - 0.132580 B^13## Innovation variance: 0.1601924#### Irregular## Innovation variance: 0.2056884

14 / 33

Page 18: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Seasonal adjustment examples

Seasonal adjustment examples (3/7)plot(x13_mod$decomposition)

−40

−30

−20

−10

010

*

******

********

*

**********

**

Jan

xd10

***********

**********

*

******

Feb

xd10

*

*

******

*

**

********

*

*******

*

Mar

xd10

*******

*

********

***********

*

Apr

xd10

******

***************

*

**

*

***

May

xd10

*

*******

******

**

*********

***

Jun

xd10

******

**

*********

****

****

***

Jul

xd10

*****

***

*

**

**

*

*

****

*

**

*

****

*

Aug

xd10

********

*******

**

***********

Sepxd

10

*******

*****

*

**

*******

*****

*

Oct

xd10

*

***

*

**

*

****

*

**

*

*****

*

**

**

**

Nov

xd10

*****

*

*****

*

*****

*

*

*****

****

Dec

S−I ratio

15 / 33

Page 19: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Seasonal adjustment examples

Seasonal adjustment examples (4/7)x13_mod$final

## Last observed values## y sa t s i## Jan 2017 97.4 100.6172 100.6174 -3.2172329 -0.0001992082## Feb 2017 97.5 100.3127 101.0283 -2.8126932 -0.7155966863## Mar 2017 112.0 102.5469 101.4894 9.4530696 1.0575376567## Apr 2017 103.0 101.0897 101.9282 1.9103111 -0.8385432983## May 2017 100.4 103.0319 102.3136 -2.6318733 0.7182480125## Jun 2017 111.2 102.4926 102.6921 8.7074293 -0.1994894034## Jul 2017 103.4 103.1596 103.0816 0.2404277 0.0779236963## Aug 2017 79.3 103.2483 103.5055 -23.9483256 -0.2572170473## Sep 2017 109.7 103.5536 103.9555 6.1464361 -0.4019376040## Oct 2017 114.0 106.6886 104.3955 7.3113786 2.2931579296## Nov 2017 107.7 105.4631 104.7505 2.2369236 0.7125546908## Dec 2017 101.4 104.7490 105.0214 -3.3490189 -0.2723590878#### Forecasts:## y_f sa_f t_f s_f i_f## Jan 2018 101.96630 105.0963 105.1795 -3.1299775 -0.083200162## Feb 2018 102.23632 105.1464 105.2838 -2.9100563 -0.137428535## Mar 2018 113.85794 105.5026 105.3966 8.3553336 0.105971540## Apr 2018 108.47477 105.4896 105.5573 2.9851827 -0.067754048## May 2018 103.22164 105.7963 105.7844 -2.5746309 0.011859024## Jun 2018 114.64042 106.0073 106.0629 8.6331483 -0.055612674## Jul 2018 106.53519 106.3942 106.3666 0.1410119 0.027594337## Aug 2018 82.77073 106.6890 106.6849 -23.9182264 0.004061745## Sep 2018 112.79551 106.7018 106.9859 6.0936895 -0.284129714## Oct 2018 115.13202 107.7516 107.2471 7.3803800 0.504589345## Nov 2018 109.87965 107.5136 107.4572 2.3660966 0.056314698## Dec 2018 103.97193 107.3744 107.6093 -3.4024325 -0.234923742

16 / 33

Page 20: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Seasonal adjustment examples

Seasonal adjustment examples (5/7)plot(x13_mod$final, first_date = 2012, type_chart = "sa-trend")

Y, Sa, trend

Time

2012 2013 2014 2015 2016 2017 2018 2019

8090

100

110

SeriesTrendSeasonally adjusted

17 / 33

Page 21: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Seasonal adjustment examples

Seasonal adjustment examples (6/7)plot(x13_mod$final, last_date = 2000, type_chart = "cal-seas-irr")

Cal., sea., irr.

Time

1990 1992 1994 1996 1998 2000

−30

−20

−10

010

Calendar effectsSeas (component)Irregular

18 / 33

Page 22: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Seasonal adjustment examples

Seasonal adjustment examples (7/7)x13_mod$diagnostics

## Relative contribution of the components to the stationary## portion of the variance in the original series,## after the removal of the long term trend## Trend computed by Hodrick-Prescott filter (cycle length = 8.0 years)## Component## Cycle 1.557## Seasonal 39.219## Irregular 0.362## TD & Hol. 0.018## Others 61.971## Total 103.128#### Combined test in the entire series## Non parametric tests for stable seasonality## P.value## Kruskall-Wallis test 0.000## Test for the presence of seasonality assuming stability 0.000## Evolutive seasonality test 0.032#### Identifiable seasonality present#### Residual seasonality tests## P.value## qs test on sa 1.000## qs test on i 1.000## f-test on sa (seasonal dummies) 0.997## f-test on i (seasonal dummies) 0.965## Residual seasonality (entire series) 0.993## Residual seasonality (last 3 years) 0.922## f-test on sa (td) 0.001## f-test on i (td) 0.006

19 / 33

Page 23: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Export a JD+ workspace

Export a workspacewk <- new_workspace()new_multiprocessing(wk, name = "MP-1")add_sa_item(wk, multiprocessing = "MP-1",

sa_obj = x13_mod, name = "SA with X13 model 1 ")add_sa_item(wk, multiprocessing = "MP-1",

sa_obj = ts_mod, name = "SA with TramoSeats model 1")save_workspace(wk, "workspace.xml")

20 / 33

Page 24: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Import a JD+ workspace

Import a workspace

wk <- load_workspace("workspace.xml")compute(wk) # Important to get the Sa modelmodels <- get_model(wk, progress_bar = FALSE) # get all models# Or to get one specific model:mp <- get_object(wk, 1)count(mp)

## [1] 2sa2 <- get_object(mp, 2)get_name(sa2)

## [1] "SA with TramoSeats model 1"mod <- get_model(sa2, wk)

21 / 33

Page 25: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Reduce time computation

Manipulate K objects (1/2)Default functions can be time consuming (computation of outputs). . . Especially if youonly need one specific parameter

→ “Manipulate” java models: jx13, jtramoseats, jregarima, jregarima_x13,jregarima_tramoseats and get_jmodel

jx13_mod <- jx13(ipi_fr, x13_usr_spec)# To get the available outputs:tail(get_dictionary(jx13_mod), 2)

## [1] "diagnostics.msr-global" "diagnostics.msr(*)"# To get an indicator:get_indicators(jx13_mod, "diagnostics.ic-ratio")

## $`diagnostics.ic-ratio`## [1] 4.356533# To get the previous R outputx13_mod <- jSA2R(jx13_mod)

→ The output can be customize by every user/institute

22 / 33

Page 26: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

RJDemetra Reduce time computation

Manipulate K objects (1/2)Default functions can be time consuming (computation of outputs). . . Especially if youonly need one specific parameter

→ “Manipulate” java models: jx13, jtramoseats, jregarima, jregarima_x13,jregarima_tramoseats and get_jmodel

jx13_mod <- jx13(ipi_fr, x13_usr_spec)# To get the available outputs:tail(get_dictionary(jx13_mod), 2)

## [1] "diagnostics.msr-global" "diagnostics.msr(*)"# To get an indicator:get_indicators(jx13_mod, "diagnostics.ic-ratio")

## $`diagnostics.ic-ratio`## [1] 4.356533# To get the previous R outputx13_mod <- jSA2R(jx13_mod)

→ The output can be customize by every user/institute

22 / 33

Page 27: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Around RJDemetra and JDemetra+

Sommaire

1. Introduction to seasonal adjustment (SA)

2. RJDemetra

3. Around RJDemetra and JDemetra+

3.1 Around RJDemetra

3.2 Around JDemetra+

4. Installation and future developments

23 / 33

Page 28: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace
Page 29: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Around RJDemetra and JDemetra+ Around RJDemetra

Examples of current use of RJDemetra

• ggdemetra: ggplot2 extension for ‘RJDemetra’

� https://github.com/AQLT/rjdqa• rjdqa: package to help quality assessment (dashboard and quality reportmatrix)

� https://github.com/AQLT/rjdqa• persephone: enable easy processing during production of SA series(interactive plots, dashboards. . . )

� https://github.com/statistikat/persephone• rjdmarkdown: nice rmarkdown outputs for RJDemetra

� https://github.com/AQLT/rjdmarkdown• Carry out studies on SA: Ladiray D., Quartier-la-Tente A., “(In)Stabilityof Reg-ARIMA Models for Seasonal Adjustment”

25 / 33

Page 30: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Around RJDemetra and JDemetra+ Around RJDemetra

rjdqaplot(rjdqa::sa_dashboard(x13_mod))

Seasonal Adjustment Dashboard

jan 16jan 16

mar 16av

r 16av

r 16jui 1

6jul 1

6jul 1

6

sep 16

oct 16oct

16

déc 16jan 17

fév 17

mar 17av

r 17

mai 17jui 1

7jul 1

7

aoû 17

sep 17

oct 17

nov 17

déc 17

8090

110

SeriesTrendSeasonally adjusted

Recent History

Value Indicator Adjustability (M7) 0.07 Residual Seasonality (qs−test on sa) 1.00 Residual Seasonality (f−test on sa) 1.00Residual Trading−days effects (f−test on sa) 0.00 ARIMA autocorrelation (lb test) 0.06 Recent Outliers (current period) Regular Recent Outliers (previous period) Regular

Summary of Key Diagnostics

Net Effect of Seasonal Adjustment

Monday Thursday Saturday

−1.

00.

01.

0

Previous Month +0.0%Current Month +0.0%

Trading Day Effects: ⇒ expected

Jan Mar May Jul Sep Nov

−0.

3−

0.1

0.1

0.3

Previous Month +0.0%Current Month +0.0%

Moving Holiday Effects: ⇒ expected

Jan Mar May Jul Sep Nov

−20

−10

0

Previous Month +2.2%Current Month −3.3%

Seasonal Effects: ⇓ expected

Estimated Patterns and Anticipated Movements

101

104

107

Unadjusted (Raw)

m−1 m

Raw, −5.8%Raw NeutralRaw Boundaries

Observed 5.8% raw decrease from last month

Neutral result requires 5.2% raw decreasefrom last month:

No trading day effectNo moving holiday effectSeasonal effects represent 5.2% raw decrease

SA movement of −0.7% from last month 104.

010

5.5

Seasonally Adjusted (SA)

m−1 m

SA, −0.7%SA NeutralSA Boundaries

Reference Month: 2017−12

26 / 33

Page 31: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Around RJDemetra and JDemetra+ Around RJDemetra

ggdemetra

27 / 33

Page 32: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Around RJDemetra and JDemetra+ Around JDemetra+

Around JDemetra+

• State space framework of JD+:� https://github.com/nbbrd/rjdssf

• Benchmarking and temporal disaggregation:� https://github.com/palatej/rjdbench

• R interface to the JWSACruncher (console tool to refresh the models of aJD+ workspace):� https://github.com/AQLT/rjwsacruncher

28 / 33

Page 33: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Installation and future developments

Sommaire

1. Introduction to seasonal adjustment (SA)

2. RJDemetra

3. Around RJDemetra and JDemetra+

4. Installation and future developments

4.1 How to install the package?

4.2 Why use RJDemetra?

4.3 Future developments

29 / 33

Page 34: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Installation and future developments How to install the package?

How to install the package?

The package is available on �: https://github.com/jdemetra/rjdemetra# Cran releaseinstall.packages("RJDemetra")

# Development versiondevtools::install_github("jdemetra/rjdemetra")

To install it you need Java8: in case you don’t, see the installationmanualhttps://github.com/jdemetra/rjdemetra/wiki/Installation-manual

30 / 33

Page 35: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Installation and future developments Why use RJDemetra?

Why use RJDemetra

• Methods used are recommended by Eurostat• Performance and integration in production with JDemetra+• Lots of ^ developments around RJDemetra

• RJDemetra evolves with JDemetra+: will integrate new developments onSA methods

31 / 33

Page 36: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Installation and future developments Future developments

What’s next?

• documentation: article for the Journal of Statistical Software + cheatsheet

• shiny app to change the specification

With JD+ 3.0.0 (by the end of 2020):• Function to “refresh” the model• Compatibility with all frequencies (JD+ daily, weekly, etc.)

32 / 33

Page 37: RJDemetra: an R interface to JDemetra+ - 07 - useR! 2019/rjdemetra.pdf · 2.1 Currentstatus 2.2 RegARIMAexamples 2.3 Seasonaladjustmentexamples 2.4 ExportaJD+workspace 2.5 ImportaJD+workspace

Installation and future developments Future developments

Thank you for your attention. . .

. . . And don’t forget your stickers!

Alain Quartier-la-Tente£ [email protected] �@AlainQlt

� jdemetra/rjdemetra� @JdemetraPlus

33 / 33