rjdverse / rjd3tramoseats

R access to Tramo-Seats algorithm in JDemetra+ version 3.x
https://rjdverse.github.io/rjd3tramoseats/
European Union Public License 1.2
4 stars 6 forks source link

Adding span in `print.JD3_TRAMOSEATS_OUTPUT` #36

Open TanguyBarthelemy opened 6 months ago

TanguyBarthelemy commented 6 months ago

In the display of the output af a SA with tramoseats(), the model span and estimation span don't appear:

library("rjd3toolkit")
#> 
#> Attachement du package : 'rjd3toolkit'
#> Les objets suivants sont masqués depuis 'package:stats':
#> 
#>     aggregate, mad
library("rjd3tramoseats")
mod <- tramoseats(ABS[, 3])
print(mod)
#> TRAMO
#> Log-transformation: yes 
#> SARIMA model:  (0,1,1) (0,1,1)
#> 
#> Coefficients
#>           Estimate Std. Error T-stat
#> theta(1)  -0.53263    0.04352 -12.24
#> btheta(1) -0.68006    0.04759 -14.29
#> 
#> Regression model:
#>                  Estimate Std. Error T-stat
#> monday          -0.002354   0.003197 -0.736
#> tuesday          0.005328   0.003208  1.661
#> wednesday       -0.001262   0.003213 -0.393
#> thursday         0.009371   0.003252  2.881
#> friday           0.005155   0.003251  1.586
#> saturday         0.001834   0.003235  0.567
#> lp               0.042009   0.009963  4.216
#> AO (2000-06-01)  0.216338   0.028135  7.689
#> AO (2000-09-01)  0.121942   0.028132  4.335
#> Number of observations:  425 
#> Number of effective observations:  412 
#> Number of parameters:  12 
#> 
#> Loglikelihood:  803.5446 
#> Adjusted loglikelihood:  -1867.932 
#> 
#> Standard error of the regression (ML estimate):  0.03409052 
#> AIC:  3759.865 
#> AICC:  3760.647 
#> BIC:  3808.117 
#> 
#> 
#> Decomposition
#> model 
#> 
#> DIF:  1 -1 0 0 0 0 0 0 0 0 0 0 -1 1 
#> MA:  1 -0.5326308 0 0 0 0 0 0 0 0 0 0 -0.680057 0.3622192 
#> var:  1 
#> 
#> trend 
#> 
#> DIF:  1 -2 1 
#> MA:  1 0.03157631 -0.9684237 
#> var:  0.03893321 
#> 
#> seasonal 
#> 
#> DIF:  1 1 1 1 1 1 1 1 1 1 1 1 
#> MA:  1 1.215097 1.147765 0.9842106 0.7452866 0.4933379 0.2500601 0.0320089 -0.1365185 -0.2821708 -0.3705859 -0.5873774 
#> var:  0.02464385 
#> 
#> irregular 
#> 
#> var:  0.4143983 
#> 
#> 
#> 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         2.744
#>  seasonal     92.928
#>  irregular     1.359
#>  calendar      0.850
#>  others        0.650
#>  total        98.532
#> 
#> 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 1281.7 1319.916 1333.766 0.9710470 0.9896152
#> Oct 2016 1304.3 1331.621 1336.914 0.9794826 0.9960409
#> Nov 2016 1389.7 1340.670 1342.369 1.0365713 0.9987343
#> Dec 2016 2130.4 1372.032 1346.216 1.5527331 1.0191772
#> Jan 2017 1271.0 1356.615 1344.361 0.9368909 1.0091147
#> Feb 2017  999.0 1317.134 1339.984 0.7584648 0.9829477
#> Mar 2017 1227.2 1324.510 1340.040 0.9265313 0.9884107
#> Apr 2017 1309.3 1352.401 1344.225 0.9681300 1.0060826
#> May 2017 1378.0 1344.668 1348.648 1.0247886 0.9970483
#> Jun 2017 1369.7 1354.065 1352.881 1.0115470 1.0008749
#> Jul 2017 1286.3 1368.888 1356.032 0.9396681 1.0094804
#> Aug 2017 1233.2 1344.549 1357.892 0.9171851 0.9901738

Created on 2024-04-04 with reprex v2.1.0

AQLT commented 6 months ago

On this subject my opinion is that the default print output is too long and complicated for a simple use. I would rather propose a huge simplification for the print method (for exemple only keeping the RegARIMA coefficients) and a detailed output with summary() functions. Below an example of a simplify print option.

#> Method: TRAMO-SEATS
#> Log-transformation: yes 
#> SARIMA model:  (0,1,1) (0,1,1)
#> 
#> SARIMA coefficients:
#>  theta(1) btheta(1)
#>  -0.53263  -0.68006
#> Regression model:
#>    monday tuesday wednesday thursday  friday saturday      lp AO (2000-06-01)
#>  -0.00235 0.00533  -0.00126  0.00937 0.00515  0.00183 0.04201         0.21634
#>  AO (2000-09-01)
#>          0.12194

Concerning model span and estimation span it's more a compromise between clarity and completeness: to what extent do we want to recall the specifications? For example, do we want to distinguish between atypical points imposed by the user and those detected automatically?

TanguyBarthelemy commented 5 months ago

related to rjdverse/rjd3x13#45

TanguyBarthelemy commented 2 months ago

Thank you very much @AQLT for your PR that improves a lot the information available for the user (with new summary()). Concerning the span, I know that @annasmyk was very attached to it. So we'll certainly be doing a PR in this direction to add this information to the summary.