Skip to content

when unique user-defined td regressor has usertd as name #54

@TanguyBarthelemy

Description

@TanguyBarthelemy

When we adjust a series in R with {rjd3tramoseats} with more than one regressor. Their names will be printed in the summary :

library("rjd3toolkit")
#> 
#> Attaching package: 'rjd3toolkit'
#> The following objects are masked from 'package:stats':
#> 
#>     aggregate, mad
library("rjd3tramoseats")


y <- austres
regs <- ts(cbind(x = runif(89), y = runif(89)), start = c(1971, 2), frequency = 4)
my_context <- modelling_context(variables = list(td = regs))

spec <- tramoseats_spec("rsa3") |> 
    set_tradingdays(option = "UserDefined", uservariable = c("td.x", "td.y"))

mod <- tramoseats_fast(y, spec = spec, context = my_context)
summary(mod)
#> Model: TRAMO-SEATS
#> Log-transformation: yes 
#> SARIMA model: (0,2,0) (0,1,1)
#> 
#> Coefficients
#>           Estimate Std. Error T-stat Pr(>|t|)    
#> btheta(1)  -0.5543     0.1045 -5.306 1.12e-06 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Regression model:
#>                   Estimate Std. Error T-stat Pr(>|t|)    
#> td.x            -6.203e-06  5.843e-05 -0.106 0.915754    
#> td.y             1.777e-05  6.139e-05  0.290 0.773013    
#> AO (1974-10-01)  6.749e-04  1.386e-04  4.868 6.34e-06 ***
#> TC (1978-10-01) -7.617e-04  2.075e-04 -3.671 0.000457 ***
#> TC (1981-04-01) -8.711e-04  2.018e-04 -4.317 4.89e-05 ***
#> AO (1988-04-01) -6.199e-04  1.510e-04 -4.106 0.000104 ***
#> LS (1990-07-01) -2.412e-03  2.413e-04 -9.998 2.57e-15 ***
#> LS (1992-01-01) -1.649e-03  2.522e-04 -6.541 7.31e-09 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> Number of observations: 89, Number of effective observations: 83, Number of parameters: 10
#> Loglikelihood: 541.0693, Adjusted loglikelihood: -259.0635
#> Standard error of the regression (ML estimate): 0.000353831 
#> AIC: 538.1271, AICc: 541.1826, BIC: 562.3155
#> 
#> Decomposition
#> model 
#> 
#> DIF: 1 -2 1 0 -1 2 -1 
#> MA: 1 0 0 0 -0.5542921 
#> var:  1 
#> 
#> trend 
#> 
#> DIF: 1 -3 3 -1 
#> MA: 1 -0.0460761 -0.8879769 0.1580992 
#> var:  0.2473462 
#> 
#> seasonal 
#> 
#> DIF: 1 1 1 1 
#> MA: 1 1.536064 1.149295 0.1042712 
#> var:  0.01198268 
#> 
#> irregular 
#> 
#> var:  0.0378558 
#> 
#> 
#> 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        62.348
#>  seasonal      0.781
#>  irregular     0.030
#>  calendar      0.001
#>  others       28.397
#>  total        91.557
#> 
#> Residual seasonality tests
#>                 P.value
#>  seas.ftest.i     0.879
#>  seas.ftest.sa    0.989
#>  seas.qstest.i    1.000
#>  seas.qstest.sa   1.000
#>  td.ftest.i       0.271
#>  td.ftest.sa      0.993
#> 
#> 
#> Final
#> Last values
#>          series       sa    trend      seas       irr
#> 1992 Q3 17526.0 17529.03 17528.43 0.9998270 1.0000346
#> 1992 Q4 17568.7 17571.31 17572.37 0.9998513 0.9999400
#> 1993 Q1 17627.1 17619.09 17618.39 1.0004547 1.0000398
#> 1993 Q2 17661.5 17663.32 17663.45 0.9998970 0.9999926

Created on 2024-12-18 with reprex v2.1.1

On the other hand, if we only use one regressor, the printed name will be usertd which is not very indicative:

spec <- tramoseats_spec("rsa3") |> 
    set_tradingdays(option = "UserDefined", uservariable = "td.x")

mod <- tramoseats_fast(y, spec = spec, context = my_context)
summary(mod)
#> Model: TRAMO-SEATS
#> Log-transformation: yes 
#> SARIMA model: (1,1,0) (0,1,1)
#> 
#> Coefficients
#>           Estimate Std. Error  T-stat Pr(>|t|)    
#> phi(1)    -0.81780    0.07336 -11.148  < 2e-16 ***
#> btheta(1) -0.69530    0.09943  -6.993 8.13e-10 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Regression model:
#>                   Estimate Std. Error T-stat Pr(>|t|)    
#> usertd           2.646e-05  7.208e-05  0.367 0.714570    
#> AO (1974-10-01)  7.232e-04  1.888e-04  3.831 0.000258 ***
#> LS (1990-07-01) -2.496e-03  3.237e-04 -7.712 3.64e-11 ***
#> LS (1992-01-01) -1.557e-03  3.400e-04 -4.579 1.76e-05 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> Number of observations: 89, Number of effective observations: 84, Number of parameters: 7
#> Loglikelihood: 530.5199, Adjusted loglikelihood: -279.1126
#> Standard error of the regression (ML estimate): 0.0004296577 
#> AIC: 572.2251, AICc: 573.6988, BIC: 589.2408
#> 
#> Decomposition
#> model 
#> 
#> AR: 1 -0.8178025 
#> DIF: 1 -1 0 0 -1 1 
#> MA: 1 0 0 0 -0.6952956 
#> var:  1 
#> 
#> trend 
#> 
#> AR: 1 -0.8178025 
#> DIF: 1 -2 1 
#> MA: 1 -0.08783414 -0.9283223 0.1595119 
#> var:  0.2823638 
#> 
#> seasonal 
#> 
#> DIF: 1 1 1 1 
#> MA: 1 1.529853 1.13771 0.09604498 
#> var:  0.006703832 
#> 
#> irregular 
#> 
#> var:  0.05443102 
#> 
#> 
#> 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        62.272
#>  seasonal      0.739
#>  irregular     0.091
#>  calendar      0.001
#>  others       29.278
#>  total        92.382
#> 
#> Residual seasonality tests
#>                 P.value
#>  seas.ftest.i     0.811
#>  seas.ftest.sa    0.992
#>  seas.qstest.i    1.000
#>  seas.qstest.sa   1.000
#>  td.ftest.i       0.939
#>  td.ftest.sa      0.940
#> 
#> 
#> Final
#> Last values
#>          series       sa    trend      seas       irr
#> 1992 Q3 17526.0 17528.74 17528.05 0.9998437 1.0000392
#> 1992 Q4 17568.7 17570.53 17571.88 0.9998956 0.9999233
#> 1993 Q1 17627.1 17619.56 17618.40 1.0004281 1.0000654
#> 1993 Q2 17661.5 17663.77 17664.19 0.9998714 0.9999765

Created on 2024-12-18 with reprex v2.1.1

Is it possible to display the regressors name instead of usertd in the regression table?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions