Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify print output for tramo/tramoseats #49

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

AQLT
Copy link
Contributor

@AQLT AQLT commented Jul 24, 2024

I propose to simplify the print output of the /RegARIMA and seasonal adjustment models. A message with a reference to the summary() method is added (which can be disabled with the summary_info option). This is linked to rjdverse/rjd3toolkit#56 and #36.

library(rjd3tramoseats)
y <- rjd3toolkit::ABS$X0.2.09.10.M
reg <- tramo(y)
ts_mod <- tramoseats(y)
reg
#> Method: TRAMO
#> Log-transformation: yes 
#> SARIMA model: (0,1,1) (0,1,1)
#> 
#> SARIMA coefficients:
#>  theta(1) btheta(1) 
#>   -0.8278   -0.4255 
#> 
#> Regression model:
#>          monday         tuesday       wednesday        thursday          friday 
#>      -0.0109446       0.0048940       0.0001761       0.0132928      -0.0024801 
#>        saturday              lp          easter AO (2000-06-01) AO (2000-07-01) 
#>       0.0153509       0.0410667       0.0503888       0.1681662      -0.1972348 
#> 
#> For a more detailed output, use the 'summary()' function.
summary(reg)
#> Method: TRAMO 
#> Log-transformation: yes 
#> SARIMA model: (0,1,1) (0,1,1)
#> 
#> Coefficients
#>           Estimate Std. Error  T-stat Pr(>|t|)    
#> theta(1)  -0.82783    0.02571 -32.196  < 2e-16 ***
#> btheta(1) -0.42554    0.06388  -6.661 9.01e-11 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Regression model:
#>                   Estimate Std. Error T-stat Pr(>|t|)    
#> monday          -0.0109446  0.0034805 -3.145 0.001788 ** 
#> tuesday          0.0048940  0.0035307  1.386 0.166481    
#> wednesday        0.0001761  0.0034970  0.050 0.959867    
#> thursday         0.0132928  0.0035330  3.763 0.000193 ***
#> friday          -0.0024801  0.0035383 -0.701 0.483748    
#> saturday         0.0153509  0.0035171  4.365 1.62e-05 ***
#> lp               0.0410667  0.0101178  4.059 5.94e-05 ***
#> easter           0.0503888  0.0072698  6.931 1.69e-11 ***
#> AO (2000-06-01)  0.1681662  0.0299743  5.610 3.78e-08 ***
#> AO (2000-07-01) -0.1972348  0.0298664 -6.604 1.28e-10 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> Number of observations: 425, Number of effective observations: 412, Number of parameters: 13
#> Loglikelihood: 781.358, Adjusted loglikelihood: -2086.269
#> Standard error of the regression (ML estimate): 0.03615788 
#> AIC: 4198.538, AICc: 4199.452, BIC: 4250.811
ts_mod
#> Model: TRAMO-SEATS
#> Log-transformation: yes 
#> SARIMA model: (0,1,1) (0,1,1)
#> 
#> SARIMA coefficients:
#>  theta(1) btheta(1) 
#>   -0.8278   -0.4255 
#> 
#> Regression model:
#>          monday         tuesday       wednesday        thursday          friday 
#>      -0.0109446       0.0048940       0.0001761       0.0132928      -0.0024801 
#>        saturday              lp          easter AO (2000-06-01) AO (2000-07-01) 
#>       0.0153509       0.0410667       0.0503888       0.1681662      -0.1972348 
#> 
#> For a more detailed output, use the 'summary()' function.
options(summary_info = FALSE) # to remove the last line
ts_mod
#> Model: TRAMO-SEATS
#> Log-transformation: yes 
#> SARIMA model: (0,1,1) (0,1,1)
#> 
#> SARIMA coefficients:
#>  theta(1) btheta(1) 
#>   -0.8278   -0.4255 
#> 
#> Regression model:
#>          monday         tuesday       wednesday        thursday          friday 
#>      -0.0109446       0.0048940       0.0001761       0.0132928      -0.0024801 
#>        saturday              lp          easter AO (2000-06-01) AO (2000-07-01) 
#>       0.0153509       0.0410667       0.0503888       0.1681662      -0.1972348
summary(reg)
#> Method: TRAMO 
#> Log-transformation: yes 
#> SARIMA model: (0,1,1) (0,1,1)
#> 
#> Coefficients
#>           Estimate Std. Error  T-stat Pr(>|t|)    
#> theta(1)  -0.82783    0.02571 -32.196  < 2e-16 ***
#> btheta(1) -0.42554    0.06388  -6.661 9.01e-11 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Regression model:
#>                   Estimate Std. Error T-stat Pr(>|t|)    
#> monday          -0.0109446  0.0034805 -3.145 0.001788 ** 
#> tuesday          0.0048940  0.0035307  1.386 0.166481    
#> wednesday        0.0001761  0.0034970  0.050 0.959867    
#> thursday         0.0132928  0.0035330  3.763 0.000193 ***
#> friday          -0.0024801  0.0035383 -0.701 0.483748    
#> saturday         0.0153509  0.0035171  4.365 1.62e-05 ***
#> lp               0.0410667  0.0101178  4.059 5.94e-05 ***
#> easter           0.0503888  0.0072698  6.931 1.69e-11 ***
#> AO (2000-06-01)  0.1681662  0.0299743  5.610 3.78e-08 ***
#> AO (2000-07-01) -0.1972348  0.0298664 -6.604 1.28e-10 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> Number of observations: 425, Number of effective observations: 412, Number of parameters: 13
#> Loglikelihood: 781.358, Adjusted loglikelihood: -2086.269
#> Standard error of the regression (ML estimate): 0.03615788 
#> AIC: 4198.538, AICc: 4199.452, BIC: 4250.811
summary(ts_mod) # previous output
#> Model: TRAMO-SEATS
#> Log-transformation: yes 
#> SARIMA model: (0,1,1) (0,1,1)
#> 
#> Coefficients
#>           Estimate Std. Error  T-stat Pr(>|t|)    
#> theta(1)  -0.82783    0.02571 -32.196  < 2e-16 ***
#> btheta(1) -0.42554    0.06388  -6.661 9.01e-11 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Regression model:
#>                   Estimate Std. Error T-stat Pr(>|t|)    
#> monday          -0.0109446  0.0034805 -3.145 0.001788 ** 
#> tuesday          0.0048940  0.0035307  1.386 0.166481    
#> wednesday        0.0001761  0.0034970  0.050 0.959867    
#> thursday         0.0132928  0.0035330  3.763 0.000193 ***
#> friday          -0.0024801  0.0035383 -0.701 0.483748    
#> saturday         0.0153509  0.0035171  4.365 1.62e-05 ***
#> lp               0.0410667  0.0101178  4.059 5.94e-05 ***
#> easter           0.0503888  0.0072698  6.931 1.69e-11 ***
#> AO (2000-06-01)  0.1681662  0.0299743  5.610 3.78e-08 ***
#> AO (2000-07-01) -0.1972348  0.0298664 -6.604 1.28e-10 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> Number of observations: 425, Number of effective observations: 412, Number of parameters: 13
#> Loglikelihood: 781.358, Adjusted loglikelihood: -2086.269
#> Standard error of the regression (ML estimate): 0.03615788 
#> AIC: 4198.538, AICc: 4199.452, BIC: 4250.811
#> 
#> Decomposition
#> model 
#> 
#> DIF: 1 -1 0 0 0 0 0 0 0 0 0 0 -1 1 
#> MA: 1 -0.8278316 0 0 0 0 0 0 0 0 0 0 -0.4255409 0.3522762 
#> var:  1 
#> 
#> trend 
#> 
#> DIF: 1 -2 1 
#> MA: 1 0.06437327 -0.9356267 
#> var:  0.004098184 
#> 
#> seasonal 
#> 
#> DIF: 1 1 1 1 1 1 1 1 1 1 1 1 
#> MA: 1 0.6197472 0.3121522 0.07325877 -0.1026014 -0.2222985 -0.2934508 -0.3240296 -0.3220203 -0.295141 -0.2506158 -0.1950007 
#> var:  0.1460322 
#> 
#> irregular 
#> 
#> var:  0.384587 
#> 
#> 
#> 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 (in %)
#> 
#>            Component
#>  cycle         0.250
#>  seasonal     97.046
#>  irregular     0.600
#>  calendar      0.741
#>  others        0.325
#>  total        98.962
#> 
#> Residual seasonality tests
#>                 P.value
#>  seas.ftest.i         1
#>  seas.ftest.sa        1
#>  seas.qstest.i        1
#>  seas.qstest.sa       1
#>  td.ftest.i           1
#>  td.ftest.sa          1
#> 
#> 
#> Final
#> Last values
#>          series       sa    trend      seas       irr
#> Sep 2016 1393.5 1552.616 1561.206 0.8975174 0.9944979
#> Oct 2016 1497.4 1568.366 1559.217 0.9547514 1.0058681
#> Nov 2016 1684.3 1528.962 1557.382 1.1015974 0.9817508
#> Dec 2016 2850.4 1542.997 1556.132 1.8473143 0.9915588
#> Jan 2017 1428.5 1545.950 1555.502 0.9240275 0.9938587
#> Feb 2017 1092.4 1551.369 1555.210 0.7041521 0.9975303
#> Mar 2017 1370.3 1553.207 1555.087 0.8822391 0.9987913
#> Apr 2017 1522.6 1580.752 1554.759 0.9632123 1.0167187
#> May 2017 1452.4 1554.517 1553.908 0.9343093 1.0003924
#> Jun 2017 1557.2 1551.804 1552.778 1.0034774 0.9993726
#> Jul 2017 1445.5 1544.701 1551.717 0.9357801 0.9954781
#> Aug 2017 1303.1 1535.588 1550.949 0.8485999 0.9900960

@TanguyBarthelemy
Copy link
Contributor

As your PR in {rjd3xr13}, I accept and merge your modifications.
Thank you.

@TanguyBarthelemy TanguyBarthelemy merged commit 3524c53 into rjdverse:develop Aug 19, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants