Skip to contents

Class "SubsetPM" - subset PAR models with trigonometric parameterisation.

Objects from the Class

Objects can be created by calls of the form new("SubsetPM", ...) but they are typically created by model fitting functions, see the examples.

Slots

theTS:

"ANY", the time series to which the model is fitted.

period:

"integer", the period.

order:

"integer", the order.

findex:

"function".

harmonics:

"integer", Fourier harmonics to include in the model.

call:

"call", the call used to fit the model.

other:

"namedList".

Methods

coef

signature(object = "SubsetPM"): ...

fitted

signature(object = "SubsetPM"): ...

residuals

signature(object = "SubsetPM"): ...

show

signature(object = "SubsetPM"): ...

vcov

signature(object = "SubsetPM"): ...

Examples

pcfr4 <- pcts(dataFranses1996)[[4]]
x4 <- as.numeric(window(pcfr4, start = availStart(pcfr4), end = availEnd(pcfr4)))

## without 'harmonics' these models are equivalent
tmpfit  <- fit_trigPAR_optim(x4, 2, 4, tol = 1e-14, verbose = FALSE)
tmpfitL <- fit_trigPAR_optim(x4, 2, 4, tol = 1e-14, type = "bylag", verbose = FALSE)

## for comparison
tmpfitP <- pclsdf(x4, 4, 1:2, sintercept = FALSE)

## with intercept
tmpfitc  <- fit_trigPAR_optim(x4, 2, 4, tol = 1e-14, verbose = FALSE,
    sintercept = TRUE)
tmpfitcn  <- fit_trigPAR_optim(x4, 2, 4, tol = 1e-14, verbose = FALSE,
    sintercept = structure(TRUE, merge = TRUE))
tmpfitLc <- fit_trigPAR_optim(x4, 2, 4, tol = 1e-14, type = "bylag",
    verbose = FALSE, sintercept = TRUE)

coef(tmpfitc, matrix = TRUE)
#>                 [,1]
#> C_h0     11.01864998
#> C_h1cos -18.35545186
#> C_h1sin -14.20657604
#> C_h2    -16.09720546
#> h0        1.38811806
#> h1cos     0.03694445
#> h1sin    -0.10197056
#> h2cos     0.89914498
#> h2sin     0.81695108
#> h3cos    -0.13550727
#> h3sin    -0.04146482
#> h4       -1.09146423
coef(tmpfitcn, matrix = TRUE)
#>             [,1]
#> h0      7.495014
#> h1cos -12.359129
#> h1sin   5.013599
#> h2cos   6.972287
#> h2sin  11.960115
#> h3cos  10.548911
#> h3sin  -8.268658
#> h4cos  -5.042866
#> h4sin   6.551571
#> h5cos   1.689504
#> h5sin -13.356361
#> h6     -8.302937
coef(tmpfitLc, matrix = TRUE)
#>       Sintercept       Lag_1       Lag_2
#> h0      11.01865  1.75332945  0.20976594
#> h1cos  -18.35545  0.15794355 -0.06969444
#> h1sin  -14.20658  0.01450817 -0.04278402
#> h2     -16.09721 -0.81695108  0.89914498

coef(tmpfitc)
#>         C_h0      C_h1cos      C_h1sin         C_h2           h0        h1cos 
#>  11.01864998 -18.35545186 -14.20657604 -16.09720546   1.38811806   0.03694445 
#>        h1sin        h2cos        h2sin        h3cos        h3sin           h4 
#>  -0.10197056   0.89914498   0.81695108  -0.13550727  -0.04146482  -1.09146423 
coef(tmpfitcn)
#>         h0      h1cos      h1sin      h2cos      h2sin      h3cos      h3sin 
#>   7.495014 -12.359129   5.013599   6.972287  11.960115  10.548911  -8.268658 
#>      h4cos      h4sin      h5cos      h5sin         h6 
#>  -5.042866   6.551571   1.689504 -13.356361  -8.302937 
coef(tmpfitLc)
#>         C_h0      C_h1cos      C_h1sin         C_h2      Lag1_h0   Lag1_h1cos 
#>  11.01864998 -18.35545186 -14.20657604 -16.09720546   1.75332945   0.15794355 
#>   Lag1_h1sin      Lag1_h2      Lag2_h0   Lag2_h1cos   Lag2_h1sin      Lag2_h2 
#>   0.01450817  -0.81695108   0.20976594  -0.06969444  -0.04278402   0.89914498 

coef(tmpfit)
#>          h0       h1cos       h1sin       h2cos       h2sin       h3cos 
#>  1.40791663 -0.19130838  0.05886061  1.39162629  1.34741911  0.27824691 
#>       h3sin          h4 
#> -0.50995470 -1.04530311 
coef(tmpfitL)
#>      Lag1_h0   Lag1_h1cos   Lag1_h1sin      Lag1_h2      Lag2_h0   Lag2_h1cos 
#>  1.734688313 -0.009230596 -0.460324686 -1.347419108  0.256406474  0.061474825 
#>   Lag2_h1sin      Lag2_h2 
#>  0.402213170  1.391626291 

## convert to PAR coefficients:
coef(tmpfitc,  type = "PAR", matrix = TRUE)
#>          Sintercept     Lag_1      Lag_2
#> Season_1   3.512361 1.2953991 -0.3749424
#> Season_2  10.439987 0.3565062  0.6037369
#> Season_3  23.603494 1.2748814 -0.3144367
#> Season_4 -15.518542 0.5798721  0.5051740
coef(tmpfitcn, type = "PAR", matrix = TRUE)
#>          Sintercept     Lag_1      Lag_2
#> Season_1   3.512361 1.2953991 -0.3749424
#> Season_2  10.439987 0.3565062  0.6037369
#> Season_3  23.603494 1.2748814 -0.3144367
#> Season_4 -15.518542 0.5798721  0.5051740
coef(tmpfitLc, type = "PAR", matrix = TRUE)
#>          Sintercept     Lag_1      Lag_2
#> Season_1   3.512361 1.2953991 -0.3749424
#> Season_2  10.439987 0.3565062  0.6037369
#> Season_3  23.603494 1.2748814 -0.3144367
#> Season_4 -15.518542 0.5798721  0.5051740

coef(tmpfitL, type = "PAR", matrix = TRUE)
#>              Lag_1      Lag_2
#> Season_1 1.2155550 -0.2832022
#> Season_2 0.2001616  0.7805471
#> Season_3 1.8665524 -0.8520176
#> Season_4 0.1871076  0.8674856



predict(tmpfitc, n.ahead = 4)
#> [1] 491.8044 513.6137 484.4487 493.2365
predict(tmpfitcn, n.ahead = 4)
#> [1] 491.8044 513.6137 484.4487 493.2365

sqrt(diag((vcov(tmpfitL))))
#>    XLag1_h0 XLag1_h1cos XLag1_h1sin    XLag1_h2    XLag2_h0 XLag2_h1cos 
#>   0.1418448   0.1408195   0.1428627   0.1418448   0.1417504   0.1363816 
#> XLag2_h1sin    XLag2_h2 
#>   0.1469231   0.1417504 
e <- residuals(tmpfitL)
fi <-  fitted(tmpfitL)