The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Simple Case Studies

library(fastTS)
library(magrittr) # for pipe

Lake Huron data set

data("LakeHuron")

fit_LH <- fastTS(LakeHuron)

fit_LH
#> An endogenous PACF-based fastTS model.
#> 
#>  PF_gamma AICc_d BIC_d
#>      0.00   4.17  6.56
#>      0.25   3.34  3.54
#>      0.50   2.98  3.22
#>      1.00   1.06  1.24
#>      2.00    *0*   *0*
#>      4.00   6.79   2.9
#>      8.00   6.79   2.9
#>     16.00   6.79   2.9
#> 
#> AICc_d and BIC_d are the difference from the minimum; *0* is best.
#> 
#> - Best AICc model: 4 active terms
#> - Best BIC  model: 4 active terms
#> 
#> Test-set prediction accuracy (20% held-out test set)
#>        rmse       rsq       mae
#> AICc 0.7751 0.6043019 0.5888855
#> BIC  0.7751 0.6043019 0.5888855
coef(fit_LH)
#>                 0.00069
#> (Intercept) 111.8740292
#> lag1          1.1003545
#> lag2         -0.4732437
#> lag3          0.1796316
#> lag4          0.0000000
#> lag5          0.0000000
#> lag6          0.0000000
#> lag7          0.0000000
#> lag8          0.0000000
#> lag9          0.0000000

EuStockMarkets

If you have a univariate time series with suspected trend, such as the EuStockMarkets data set,

data("EuStockMarkets")
X <- as.numeric(time(EuStockMarkets))
X_sp <- splines::bs(X-min(X), df = 9)

fit_stock <- fastTS(log(EuStockMarkets[,1]), n_lags_max = 400, X = X_sp, w_exo = "unpenalized")
fit_stock
#> A PACF-based fastTS model with 9 exogenous features.
#> 
#>  PF_gamma AICc_d BIC_d
#>      0.00  11.36 28.22
#>      0.25   2.18  4.41
#>      0.50    *0*  0.74
#>      1.00   6.46 <0.01
#>      2.00   6.46   *0*
#>      4.00   6.46 <0.01
#>      8.00   6.46 <0.01
#>     16.00   6.46 <0.01
#> 
#> AICc_d and BIC_d are the difference from the minimum; *0* is best.
#> 
#> - Best AICc model: 18 active terms
#> - Best BIC  model: 10 active terms
#> 
#> Test-set prediction accuracy (20% held-out test set)
#>            rmse       rsq       mae
#> AICc 0.09071464 0.7328887 0.0758487
#> BIC  0.09292579 0.7197084 0.0780460
tail(coef(fit_stock), 11)
#>           0.0000096
#> lag399  0.000000000
#> lag400  0.000000000
#> 1       0.251818563
#> 2      -0.064008340
#> 3      -0.022147416
#> 4      -0.015421857
#> 5      -0.014734876
#> 6       0.001020223
#> 7       0.011708216
#> 8       0.311147538
#> 9       0.000000000

# insert plot? 

Seasonal examples

Nottem

data("nottem")
fit_nt <- fastTS(nottem, n_lags_max = 24)
fit_nt
#> An endogenous PACF-based fastTS model.
#> 
#>  PF_gamma AICc_d  BIC_d
#>      0.00   3.86   13.5
#>      0.25   0.43    *0*
#>      0.50    *0*   3.74
#>      1.00   2.49   3.91
#>      2.00  29.29  33.52
#>      4.00  83.31  75.53
#>      8.00 106.95  99.16
#>     16.00 212.75 201.97
#> 
#> AICc_d and BIC_d are the difference from the minimum; *0* is best.
#> 
#> - Best AICc model: 9 active terms
#> - Best BIC  model: 6 active terms
#> 
#> Test-set prediction accuracy (20% held-out test set)
#>          rmse       rsq      mae
#> AICc 2.324769 0.9223185 1.747609
#> BIC  2.376213 0.9188426 1.815714
coef(fit_nt)
#>                  0.0393
#> (Intercept) 11.89830169
#> lag1         0.40437830
#> lag2         0.00000000
#> lag3        -0.06838188
#> lag4        -0.09660138
#> lag5        -0.01640032
#> lag6         0.00000000
#> lag7        -0.04079986
#> lag8         0.00000000
#> lag9         0.00000000
#> lag10        0.00000000
#> lag11        0.16707390
#> lag12        0.00000000
#> lag13        0.05894906
#> lag14        0.00000000
#> lag15        0.00000000
#> lag16        0.00000000
#> lag17        0.00000000
#> lag18        0.00000000
#> lag19        0.00000000
#> lag20        0.00000000
#> lag21        0.00000000
#> lag22        0.00000000
#> lag23        0.00000000
#> lag24        0.34816025

UKDriverDeaths

data("UKDriverDeaths")
fit_ukdd <- fastTS(UKDriverDeaths, n_lags_max = 24)
fit_ukdd
#> An endogenous PACF-based fastTS model.
#> 
#>  PF_gamma AICc_d BIC_d
#>      0.00   5.97   7.9
#>      0.25   3.91  3.91
#>      0.50   2.25  2.25
#>      1.00   0.77  0.77
#>      2.00   0.02  0.02
#>      4.00    *0*   *0*
#>      8.00  10.21  7.55
#>     16.00  39.18 33.83
#> 
#> AICc_d and BIC_d are the difference from the minimum; *0* is best.
#> 
#> - Best AICc model: 5 active terms
#> - Best BIC  model: 5 active terms
#> 
#> Test-set prediction accuracy (20% held-out test set)
#>          rmse       rsq      mae
#> AICc 170.9203 0.5776374 131.9969
#> BIC  170.9203 0.5776374 131.9969
coef(fit_ukdd)
#>                  0.0282
#> (Intercept) 198.6573213
#> lag1          0.3805100
#> lag2          0.0000000
#> lag3          0.0000000
#> lag4          0.0000000
#> lag5          0.0000000
#> lag6          0.0000000
#> lag7          0.0000000
#> lag8          0.0000000
#> lag9          0.0000000
#> lag10         0.0000000
#> lag11         0.1645141
#> lag12         0.4682378
#> lag13         0.0000000
#> lag14        -0.1357345
#> lag15         0.0000000
#> lag16         0.0000000
#> lag17         0.0000000
#> lag18         0.0000000
#> lag19         0.0000000
#> lag20         0.0000000
#> lag21         0.0000000
#> lag22         0.0000000
#> lag23         0.0000000
#> lag24         0.0000000

sunspot


data("sunspot.month")
fit_ssm <- fastTS(sunspot.month)
fit_ssm
#> An endogenous PACF-based fastTS model.
#> 
#>  PF_gamma AICc_d  BIC_d
#>      0.00  24.92  38.93
#>      0.25   7.88    *0*
#>      0.50    *0*   0.48
#>      1.00  69.15   35.7
#>      2.00 221.33 131.01
#>      4.00 434.49 332.77
#>      8.00 434.49 332.77
#>     16.00 434.49 332.77
#> 
#> AICc_d and BIC_d are the difference from the minimum; *0* is best.
#> 
#> - Best AICc model: 23 active terms
#> - Best BIC  model: 14 active terms
#> 
#> Test-set prediction accuracy (20% held-out test set)
#>          rmse       rsq      mae
#> AICc 15.94153 0.8920102 11.85384
#> BIC  16.04978 0.8905385 11.99382

Model summaries

summary(fit_ssm)
#> Model summary (ncvreg) at optimal AICc (lambda=0.0514; gamma=0.5)
#> lasso-penalized linear regression with n=2224, p=317
#> At lambda=0.0514:
#> -------------------------------------------------
#>   Nonzero coefficients         :  22
#>   Expected nonzero coefficients:   9.57
#>   Average mfdr (22 features)   :   0.435
#> 
#>         Estimate       z       mfdr Selected
#> lag1    0.543429 75.5671    < 1e-04        *
#> lag2    0.100936 14.3108    < 1e-04        *
#> lag9    0.095814 13.9892    < 1e-04        *
#> lag4    0.088981 12.7748    < 1e-04        *
#> lag3    0.077649 11.1365    < 1e-04        *
#> lag6    0.058591  8.7845    < 1e-04        *
#> lag5    0.031138  4.9444 0.00032487        *
#> lag18  -0.028505 -4.4224 0.00358883        *
#> lag102  0.021959  3.7402 0.05826384        *
#> lag27  -0.019987 -3.4042 0.10962497        *
#> lag212 -0.018947 -3.1479 0.18172134        *
#> lag24  -0.018334 -3.0999 0.22925539        *
#> lag111  0.017205  2.9704 0.42075053        *
#> lag92   0.017222  2.8639 0.56575685        *
#> lag12   0.012107  2.3759 1.00000000        *
#> lag20  -0.007329 -1.6906 1.00000000        *
#> lag21  -0.009982 -2.0002 1.00000000        *
#> lag34  -0.004472 -1.3302 1.00000000        *
#> lag55  -0.003429 -1.2274 1.00000000        *
#> lag96   0.001556  1.0625 1.00000000        *
#> lag275  0.000595  0.8962 1.00000000        *
#> lag292 -0.010658 -1.9653 1.00000000        *

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.