Skip to contents

Load package

Prepare dataset

In a first example, we want to model the well-known AirPassenger time series (ts object). The dataset contains monthly totals of international airline passengers (in thousands) from January 1949 to December 1960 with 144 observations in total. The first 132 observations are used for model training (n_train) and last 12 observations are used for testing (n_ahead). xtrain and xtest are numeric vectors containing the training and testing data.

# Forecast horizon
n_ahead <- 12
# Number of observations (total)
n_obs <- length(AirPassengers)
# Number of observations (training data)
n_train <- n_obs - n_ahead

# Prepare train and test data as numeric vectors
xtrain <- AirPassengers[(1:n_train)]
xtest <- AirPassengers[((n_train+1):n_obs)]

xtrain
#>   [1] 112 118 132 129 121 135 148 148 136 119 104 118 115 126 141 135 125 149
#>  [19] 170 170 158 133 114 140 145 150 178 163 172 178 199 199 184 162 146 166
#>  [37] 171 180 193 181 183 218 230 242 209 191 172 194 196 196 236 235 229 243
#>  [55] 264 272 237 211 180 201 204 188 235 227 234 264 302 293 259 229 203 229
#>  [73] 242 233 267 269 270 315 364 347 312 274 237 278 284 277 317 313 318 374
#>  [91] 413 405 355 306 271 306 315 301 356 348 355 422 465 467 404 347 305 336
#> [109] 340 318 362 348 363 435 491 505 404 359 310 337 360 342 406 396 420 472
#> [127] 548 559 463 407 362 405
xtest
#>  [1] 417 391 419 461 472 535 622 606 508 461 390 432

Train ESN model

The function train_esn() is used to automatically train an ESN to the input data xtrain, where the output xmodel is an object of class esn. The object xmodel is a list containing the actual and fitted values, residuals, the internal states states_train, estimated coefficients from the ridge regression estimation, hyperparameters, etc. We can summarize the model by using the generic S3 method summary() to get detailed information on the trained model.

# Train ESN model
xmodel <- train_esn(y = xtrain)

# Plot actual and fitted values
plot(xmodel$actual, type = "l")
lines(xmodel$fitted, col = "steelblue", lwd = 2)

Plot actual and fitted values


# Summarize model
summary(xmodel)
#> 
#> --- Inputs -----------------------------------------------------
#> n_obs        = 132
#> n_diff       = 1
#> lags         = 1
#> 
#> --- Reservoir generation ---------------------------------------
#> n_states     = 52
#> alpha        = 1
#> rho          = 0.95
#> density      = 0.5
#> scale_inputs = [-0.5, 0.5]
#> scale_win    = [-0.5, 0.5]
#> scale_wres   = [-0.5, 0.5]
#> 
#> --- Model selection --------------------------------------------
#> n_models     = 104
#> df           = 17.33
#> lambda       = 0.0032

From the output above, we get the following information about the trained ESN model:

Value Description
n_obs Number of observations (i.e., length of the input time series)
n_diff Number of differences required to achieve (weak-) stationarity of the input training data
lags Lags of the output variable (response), which are used as model input
n_states Number of internal states (i.e., predictor variables or reservoir size).
alpha Leakage rate (smoothing parameter)
rho Spectral radius for scaling the reservoir weight matrix
density Density of the reservoir weight matrix
scale_inputs Input training data are scaled to the interval (-0.5, 0.5)
scale_win Input weights matrix is drawn from a random uniform distribution with interval (-0.5, 0.5)
scale_wres Reservoir weight matrix is drawn from a random uniform distribution with interval (-0.5, 0.5)
n_models Number of models evaluated during the random search optimization to find the regularization parameter lambda
df Effective degrees of freedom in the model
lambda Regularization parameter for the ridge regression estimation

Forecast ESN model

The function forecast_esn() is used to forecast the trained model xmodel for n_ahead steps into the future. The output xfcst is a list of class forecast_esn containing the point forecasts, actual and fitted values, the forecast horizon n_ahead and the model specification model_spec. We can use the generic S3 method plot() to visualize the point forecast within xfcst and add the holdout test data xtest.

# Forecast ESN model
xfcst <- forecast_esn(xmodel, n_ahead = n_ahead)
xfcst
#> $point
#>  [1] 420.1502 401.4111 450.4424 440.6994 467.7241 516.4456 591.9815 601.8765
#>  [9] 504.3060 450.0242 403.1496 440.3876
#> 
#> $interval
#>       lower(80) lower(95) upper(80) upper(95)
#>  [1,]  401.1199  410.7973  433.4562  437.7140
#>  [2,]  377.2444  385.8292  418.2900  424.9991
#>  [3,]  420.2140  432.3780  463.5960  476.8777
#>  [4,]  410.3483  417.2327  454.4972  461.8555
#>  [5,]  434.5544  446.6635  484.8790  496.1886
#>  [6,]  479.8168  494.5381  536.0383  544.5898
#>  [7,]  553.0561  568.2320  612.3655  621.9842
#>  [8,]  563.0095  581.7790  621.7005  634.2830
#>  [9,]  468.4748  483.3751  530.5566  535.8448
#> [10,]  418.3142  427.1640  470.7633  488.6746
#> [11,]  369.7031  383.2823  429.8920  442.7360
#> [12,]  401.9438  417.1686  464.2710  476.0308
#> 
#> $sim
#>           [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]     [,8]
#>  [1,] 413.2820 421.0071 414.0122 419.0551 416.7576 421.3962 411.0003 416.7576
#>  [2,] 399.8483 404.9755 404.5567 401.2969 392.4161 419.1335 386.8958 392.4161
#>  [3,] 436.0364 461.7740 454.6194 453.1673 454.1865 452.0100 444.2525 454.1865
#>  [4,] 422.9862 441.6243 461.5455 451.4363 441.4183 435.4557 446.9860 441.4183
#>  [5,] 443.5749 469.5985 479.9798 492.1297 458.9394 461.0432 466.7811 479.5090
#>  [6,] 486.8235 507.9779 529.1148 533.8677 515.3198 517.5055 526.1950 516.7272
#>  [7,] 559.8255 590.3410 590.2585 618.9750 581.7509 591.0603 598.5702 589.1201
#>  [8,] 563.3431 602.8907 591.5564 624.8550 597.7224 598.5046 621.6708 598.6455
#>  [9,] 491.6557 502.5770 499.9740 521.1725 511.8077 511.0176 518.6593 509.1904
#> [10,] 441.4288 444.3771 441.9026 457.3546 447.3556 466.0166 458.2786 446.1022
#> [11,] 390.8624 385.6759 396.7736 397.4354 396.7516 429.8949 429.8917 403.6253
#> [12,] 434.4364 415.7343 436.6115 423.5740 438.2724 464.1049 476.3632 436.2652
#>           [,9]    [,10]    [,11]    [,12]    [,13]    [,14]    [,15]    [,16]
#>  [1,] 411.8713 421.1528 417.0384 433.8757 419.0551 409.4384 414.4849 417.7343
#>  [2,] 385.8292 415.7391 396.4997 425.0786 401.2969 399.6631 387.9884 400.7740
#>  [3,] 425.5731 461.4633 461.2320 448.3537 453.1673 448.5621 446.2931 447.1420
#>  [4,] 410.3483 444.6710 451.2712 439.1004 451.4363 433.7511 436.6207 434.5151
#>  [5,] 444.0378 475.5320 470.8319 455.1912 475.1043 448.3276 477.2572 456.1416
#>  [6,] 507.8458 519.4724 511.7029 507.2084 506.3207 489.4061 512.6905 514.3104
#>  [7,] 582.9407 595.8732 585.9512 584.9572 577.4795 570.3301 593.2848 593.1795
#>  [8,] 593.3979 605.3391 598.5275 588.6944 586.6234 584.6103 597.8117 620.2423
#>  [9,] 461.9852 527.0947 491.8161 492.6075 510.4503 507.5480 504.1558 486.7646
#> [10,] 425.7165 460.0603 453.8558 453.8458 474.3028 462.6034 452.5865 446.6625
#> [11,] 374.7122 422.0274 404.7625 430.4408 405.1227 392.7912 408.4871 390.4214
#> [12,] 406.7285 444.9145 456.0733 450.0877 429.0688 430.8158 462.2267 417.3280
#>          [,17]    [,18]    [,19]    [,20]    [,21]    [,22]    [,23]    [,24]
#>  [1,] 417.0384 419.0104 415.7054 413.2820 431.0442 408.7251 412.3040 432.7106
#>  [2,] 396.4997 395.9555 395.3873 399.8483 424.9113 380.0283 407.0134 418.2900
#>  [3,] 461.2320 443.5083 436.8633 436.0364 478.3140 443.1268 461.3467 468.5826
#>  [4,] 451.2712 426.3156 420.6168 422.9862 466.2951 436.3375 454.4972 453.4845
#>  [5,] 478.0647 461.4857 447.9001 453.3112 498.7017 477.4302 496.6727 466.4037
#>  [6,] 531.7728 515.5097 496.5859 496.1584 539.7007 525.9987 523.7562 503.4364
#>  [7,] 616.4115 589.2565 571.1782 591.5709 606.8129 587.9561 592.9607 570.9797
#>  [8,] 622.3668 608.4397 595.6600 605.0802 604.7424 612.6438 598.2555 580.0588
#>  [9,] 534.3381 513.2834 502.0171 513.1658 514.8650 501.8741 487.1590 499.2146
#> [10,] 477.3897 446.1353 445.7130 465.2174 458.4009 463.1590 427.2244 458.3170
#> [11,] 439.0903 393.4654 395.5350 405.0666 405.7367 411.9524 392.9129 387.5902
#> [12,] 469.1757 419.2634 424.8445 441.4066 437.8953 455.3325 434.5230 431.9551
#>          [,25]    [,26]    [,27]    [,28]    [,29]    [,30]    [,31]    [,32]
#>  [1,] 427.8869 419.2378 418.0680 433.4562 427.7663 411.1368 411.8713 429.8385
#>  [2,] 407.2667 422.6611 391.2857 414.7518 406.8098 402.7245 385.8292 400.8498
#>  [3,] 455.6716 460.4963 433.2000 454.1660 452.6737 439.3693 425.5731 443.3154
#>  [4,] 448.0834 458.6781 414.3215 449.0651 443.4898 439.6889 410.3483 440.0084
#>  [5,] 473.2175 472.2691 409.9250 471.6964 459.8508 464.6093 440.5131 464.3690
#>  [6,] 515.5335 521.5433 476.6852 520.0327 518.5868 527.8792 492.7100 526.6354
#>  [7,] 587.8959 588.9970 549.4292 579.0406 592.4207 607.4975 588.5388 613.0498
#>  [8,] 615.2171 588.9903 562.7076 583.8910 602.9401 621.0788 600.1929 615.8101
#>  [9,] 517.2184 483.6300 479.9634 493.4334 505.1583 531.6615 512.7856 514.8658
#> [10,] 475.8943 417.8328 424.9771 439.4332 458.9076 465.8128 460.6269 455.4036
#> [11,] 419.8099 380.3928 398.7804 397.7720 377.6157 416.8522 408.0532 423.3164
#> [12,] 446.7483 421.7741 400.4292 448.1812 424.6216 453.6791 451.4677 460.2086
#>          [,33]    [,34]    [,35]    [,36]    [,37]    [,38]    [,39]    [,40]
#>  [1,] 412.3040 419.0551 418.5663 412.8102 418.0680 409.0572 431.8655 398.3342
#>  [2,] 407.0134 401.2969 408.8376 388.0321 391.2857 382.7570 408.6841 374.7257
#>  [3,] 461.3467 453.1673 471.3733 439.9834 433.2000 429.4381 454.5010 419.9838
#>  [4,] 454.4972 451.4363 455.5900 445.7883 414.3215 424.8339 458.3859 416.8658
#>  [5,] 468.6300 484.5028 490.2296 476.9615 446.9552 456.4833 484.5474 441.2638
#>  [6,] 500.7084 541.8852 522.6394 518.3388 514.6370 525.4717 535.6106 500.4879
#>  [7,] 590.9333 627.2391 589.7056 588.7833 603.5798 619.1797 594.9735 578.4116
#>  [8,] 601.3087 638.9344 607.4640 614.3002 591.2514 608.9596 608.8261 587.3489
#>  [9,] 521.1058 530.5441 497.3424 534.6231 493.1031 507.9039 499.0473 494.0645
#> [10,] 450.8462 480.0217 444.3694 460.6393 432.7097 459.1359 422.9360 436.3535
#> [11,] 411.4836 429.2115 395.9415 404.4260 383.2885 415.3389 374.5189 418.0468
#> [12,] 446.6618 475.6634 433.2142 434.0049 414.7676 466.7506 407.6600 440.9191
#>          [,41]    [,42]    [,43]    [,44]    [,45]    [,46]    [,47]    [,48]
#>  [1,] 420.4410 420.9145 433.4562 437.7140 413.7491 412.8102 423.5291 433.4562
#>  [2,] 404.9922 399.3143 414.7518 436.0122 402.3587 388.0321 405.6902 414.7518
#>  [3,] 465.8103 432.6011 454.1660 463.3500 462.3038 439.9834 443.4823 454.1660
#>  [4,] 442.3681 420.7589 449.0651 437.1703 465.8472 445.7883 441.7298 449.0651
#>  [5,] 461.1454 452.5072 474.2938 458.2085 487.6233 484.5788 466.9889 463.5921
#>  [6,] 519.4808 518.5960 522.7870 506.3186 543.3958 526.1266 527.9357 508.4482
#>  [7,] 600.1774 585.0773 605.1090 597.9215 615.6507 597.9990 604.0006 586.0221
#>  [8,] 617.4199 601.5042 630.1256 623.5100 613.8825 597.2727 612.7015 608.5199
#>  [9,] 495.4754 512.8632 528.2080 536.9425 516.3066 489.8270 515.4875 520.4608
#> [10,] 448.7651 418.8462 467.7771 489.7394 453.4944 426.6207 468.9565 461.9008
#> [11,] 402.2653 391.3547 417.0397 413.5190 395.4998 370.9362 421.2523 406.5239
#> [12,] 441.3722 418.5953 447.4355 448.7991 426.5552 424.0146 447.8377 450.6092
#>          [,49]    [,50]    [,51]    [,52]    [,53]    [,54]    [,55]    [,56]
#>  [1,] 414.1636 418.4488 421.5146 433.9933 423.4735 411.0003 423.0654 407.7425
#>  [2,] 407.8176 417.4662 416.3464 420.7831 416.5285 386.8958 405.0264 398.7772
#>  [3,] 453.1801 483.8981 475.2902 468.8717 451.6439 444.2525 446.7430 441.9784
#>  [4,] 441.3655 453.4961 440.0748 448.1594 448.7509 446.9860 441.5337 434.8162
#>  [5,] 484.7792 482.5495 464.8684 472.5442 480.7021 491.4709 484.7074 463.9633
#>  [6,] 548.3220 524.3740 504.9701 518.1665 519.2266 535.7207 552.6022 514.1245
#>  [7,] 606.7641 597.6934 568.2902 612.2895 591.7174 599.4751 607.5039 606.3757
#>  [8,] 599.2032 618.7251 581.9701 625.5741 602.2053 598.1017 599.0585 600.0704
#>  [9,] 494.3017 511.5982 484.5877 520.5418 505.1675 504.9106 496.9141 512.1356
#> [10,] 456.9172 460.4014 441.0175 466.3640 438.5844 454.4613 445.0745 464.0533
#> [11,] 436.4580 405.2721 403.7343 434.5513 402.2262 405.0203 404.6294 432.1367
#> [12,] 451.2900 438.8686 435.4139 462.4406 439.4940 448.8530 459.0691 474.1506
#>          [,57]    [,58]    [,59]    [,60]    [,61]    [,62]    [,63]    [,64]
#>  [1,] 412.3040 404.1988 429.9109 428.5196 427.7663 418.4488 420.3269 438.2292
#>  [2,] 407.0134 383.5668 406.0497 402.5236 406.8098 417.4662 404.9467 422.3341
#>  [3,] 461.3467 433.8088 453.2141 451.9946 452.6737 483.8981 454.8844 459.4581
#>  [4,] 454.4972 449.3485 437.8652 434.3423 443.4898 453.4961 433.9479 450.6424
#>  [5,] 486.6792 503.2480 476.4992 461.2175 457.5378 478.3095 463.5485 475.1734
#>  [6,] 539.6292 539.3846 525.0801 522.5903 516.4656 514.2983 519.6936 516.8749
#>  [7,] 628.1668 618.5914 592.7192 592.1614 591.0466 587.6611 587.3978 596.4945
#>  [8,] 639.6479 606.5708 594.1704 603.4175 595.6238 596.3932 600.3313 601.1843
#>  [9,] 548.0939 524.4904 490.5962 517.0747 522.3473 473.9404 493.4075 495.8188
#> [10,] 499.0825 466.4924 443.3209 459.8534 453.2346 432.8878 440.5842 445.0009
#> [11,] 452.9182 426.6570 393.5839 407.4619 419.2730 387.4335 414.4094 410.9604
#> [12,] 480.4090 457.1632 432.9180 435.0256 442.8056 434.8178 469.4254 464.6660
#>          [,65]    [,66]    [,67]    [,68]    [,69]    [,70]    [,71]    [,72]
#>  [1,] 419.0551 417.0384 421.2637 425.0515 428.3121 410.8793 427.8869 421.1528
#>  [2,] 401.2969 396.4997 405.9413 396.5521 399.3760 393.9538 407.2667 415.7391
#>  [3,] 453.1673 461.2320 452.1876 449.6855 449.2046 441.1593 455.6716 461.4633
#>  [4,] 451.4363 451.2712 460.1784 438.0866 436.1298 417.2327 448.0834 444.6710
#>  [5,] 476.7389 478.5297 485.7771 466.4571 470.8781 440.7168 479.0894 458.9025
#>  [6,] 519.3434 533.1190 522.0125 527.0729 521.3682 503.5575 538.8970 514.7573
#>  [7,] 590.9845 567.7083 603.1711 594.5301 593.7742 590.0839 624.5217 582.1354
#>  [8,] 591.3759 592.1351 606.6245 605.1245 608.0703 606.6202 637.3232 601.7388
#>  [9,] 496.5137 494.9036 533.0792 501.8857 508.8973 498.6388 540.9319 504.6357
#> [10,] 445.2356 444.0642 462.4658 448.3134 470.6862 454.4629 491.4775 458.0301
#> [11,] 408.4237 407.3582 423.1914 424.7190 429.0343 401.9482 451.2586 415.4829
#> [12,] 438.1505 435.9461 446.1271 450.6931 441.3607 436.2058 487.6223 451.2474
#>          [,73]    [,74]    [,75]    [,76]    [,77]    [,78]    [,79]    [,80]
#>  [1,] 421.4334 411.8713 414.1636 437.7140 423.4735 417.3757 427.7663 433.4562
#>  [2,] 391.8371 385.8292 407.8176 436.0122 416.5285 382.9993 406.8098 414.7518
#>  [3,] 449.6214 425.5731 453.1801 463.3500 451.6439 430.3704 452.6737 454.1660
#>  [4,] 439.4901 410.3483 441.3655 437.1703 448.7509 422.1243 443.4898 449.0651
#>  [5,] 459.6985 439.1801 451.2640 449.6333 482.5154 449.5968 460.3852 470.4353
#>  [6,] 510.9386 491.5605 494.6011 490.7627 507.1360 493.9714 517.7195 515.5040
#>  [7,] 580.3380 564.1557 575.7286 554.5777 588.9938 547.6918 592.5787 599.4997
#>  [8,] 578.9014 569.8250 609.3815 559.6915 593.6804 556.3993 602.8334 607.3394
#>  [9,] 481.0810 456.2672 480.6461 476.7862 505.9380 463.5296 509.5221 511.2772
#> [10,] 430.6649 403.0042 440.6785 422.4926 442.4623 409.1460 464.9700 458.6537
#> [11,] 383.2263 357.7230 385.7748 383.9612 395.3016 361.3625 405.8380 406.9488
#> [12,] 424.4690 403.6180 413.6089 424.9789 434.1401 394.6891 449.2432 464.2271
#>          [,81]    [,82]    [,83]    [,84]    [,85]    [,86]    [,87]    [,88]
#>  [1,] 423.5291 413.2820 409.1686 410.8793 414.4849 411.8713 438.2292 397.2332
#>  [2,] 405.6902 399.8483 380.2474 393.9538 387.9884 385.8292 422.3341 383.1639
#>  [3,] 443.4823 436.0364 420.4685 441.1593 446.2931 425.5731 459.4581 435.4982
#>  [4,] 441.7298 422.9862 426.4991 417.2327 436.6207 410.3483 450.6424 432.9279
#>  [5,] 467.4214 453.9279 459.4236 437.1380 468.2414 447.0038 467.4976 467.2308
#>  [6,] 528.1061 505.6844 506.1998 476.4602 520.0849 502.0793 503.0351 522.4341
#>  [7,] 599.8406 591.1909 590.7791 571.5093 604.4029 570.9054 576.7199 595.0125
#>  [8,] 604.4273 596.8853 599.0364 587.5745 603.0750 591.0914 585.0578 602.2753
#>  [9,] 510.1455 508.4127 506.2191 480.9488 494.9878 495.4480 477.3043 494.4073
#> [10,] 448.4914 452.8311 471.4571 429.7046 456.0569 446.4498 423.0097 447.4081
#> [11,] 424.8369 399.7985 411.4077 381.0634 407.4657 402.0038 368.5875 398.6662
#> [12,] 463.7141 449.1259 454.0314 444.6436 459.2610 425.3625 393.6260 431.5058
#>          [,89]    [,90]    [,91]    [,92]    [,93]    [,94]    [,95]    [,96]
#>  [1,] 423.0654 432.7106 434.4011 421.0071 410.0591 430.1394 427.7663 412.3040
#>  [2,] 405.0264 418.2900 409.8421 404.9755 370.6463 410.5571 406.8098 407.0134
#>  [3,] 446.7430 468.5826 470.9199 461.7740 415.8274 461.6989 452.6737 461.3467
#>  [4,] 441.5337 453.4845 459.6152 441.6243 403.8915 462.1360 443.4898 454.4972
#>  [5,] 460.2737 482.3951 495.6535 456.8010 432.2169 482.4509 464.8570 477.2761
#>  [6,] 512.3883 528.8442 543.6574 515.6105 483.2064 545.4334 509.4868 516.5969
#>  [7,] 603.1139 596.3243 602.8750 592.4158 567.5250 615.2872 596.7736 587.5876
#>  [8,] 621.9679 614.1445 619.1931 619.7104 594.1224 630.9228 602.9334 608.5516
#>  [9,] 534.6315 519.1880 509.6037 533.6598 494.2142 530.6692 507.2245 507.2235
#> [10,] 487.4978 463.5281 461.0242 462.8357 444.7415 483.3965 456.2166 450.7714
#> [11,] 430.3805 413.6355 408.3146 423.1422 391.1786 446.0346 418.3779 400.2669
#> [12,] 473.9144 452.9711 455.1332 452.0187 410.3582 451.3395 445.2376 431.8228
#>          [,97]    [,98]    [,99]   [,100]
#>  [1,] 422.2243 415.6304 398.3342 412.8102
#>  [2,] 404.3637 399.2889 374.7257 388.0321
#>  [3,] 456.5805 447.5123 419.9838 439.9834
#>  [4,] 443.7822 448.1945 416.8658 445.7883
#>  [5,] 461.6083 461.2090 431.7079 454.3934
#>  [6,] 498.9174 503.4850 476.7500 497.1509
#>  [7,] 566.9761 579.1963 551.6794 565.0607
#>  [8,] 576.6923 590.1826 567.9034 579.0712
#>  [9,] 501.0407 501.9577 491.2104 505.2575
#> [10,] 466.9605 453.1192 433.9842 458.8925
#> [11,] 400.3035 398.6069 390.3877 390.8028
#> [12,] 426.2732 435.5863 426.9578 427.5234
#> 
#> $std
#>  [1]  9.022194 13.038637 13.785774 13.838794 16.331990 15.881107 16.421861
#>  [8] 16.383333 17.441416 17.417927 18.487429 19.027445
#> 
#> $levels
#> [1] 80 95
#> 
#> $actual
#>   [1]  NA  NA  NA  NA  NA  NA  NA  NA 136 119 104 118 115 126 141 135 125 149
#>  [19] 170 170 158 133 114 140 145 150 178 163 172 178 199 199 184 162 146 166
#>  [37] 171 180 193 181 183 218 230 242 209 191 172 194 196 196 236 235 229 243
#>  [55] 264 272 237 211 180 201 204 188 235 227 234 264 302 293 259 229 203 229
#>  [73] 242 233 267 269 270 315 364 347 312 274 237 278 284 277 317 313 318 374
#>  [91] 413 405 355 306 271 306 315 301 356 348 355 422 465 467 404 347 305 336
#> [109] 340 318 362 348 363 435 491 505 404 359 310 337 360 342 406 396 420 472
#> [127] 548 559 463 407 362 405
#> 
#> $fitted
#>   [1]       NA       NA       NA       NA       NA       NA       NA       NA
#>   [9] 146.9816 130.4251 115.2509 106.4015 113.9974 112.5610 142.7890 140.6653
#>  [17] 133.3988 141.2633 171.0034 169.8233 154.6211 131.7167 124.7118 132.2487
#>  [25] 145.4968 156.1379 169.4113 161.7540 155.3824 192.2825 205.0914 200.0951
#>  [33] 183.1431 159.1954 137.8381 175.2709 170.2357 182.7745 208.9514 184.6984
#>  [41] 183.9124 195.9409 239.0134 232.6934 221.4077 182.6306 178.3072 193.2479
#>  [49] 203.0377 197.7014 218.4362 215.9644 246.6104 255.9783 261.0848 270.9694
#>  [57] 243.8682 206.4721 193.1341 206.2135 214.0910 209.8160 242.3400 233.8699
#>  [65] 232.6356 250.2745 290.4984 315.9170 256.9259 227.8865 199.4572 231.2831
#>  [73] 223.9210 228.0987 276.2045 265.3127 271.5839 306.1690 349.7491 351.2003
#>  [81] 298.6940 272.4535 244.8644 271.6241 284.0540 277.0195 307.0108 312.7092
#>  [89] 314.6767 361.8291 425.2601 397.3839 356.3534 308.4159 269.4947 308.7790
#>  [97] 318.3926 306.9866 344.2847 351.1118 357.1520 406.8810 464.5870 457.2393
#> [105] 408.0141 348.1398 309.4448 338.0822 348.2789 326.2401 373.0930 356.8166
#> [113] 367.5198 433.1142 492.1188 495.2549 439.6658 349.3117 319.1499 343.4011
#> [121] 353.3759 331.1060 392.1569 388.8980 418.5426 479.8462 535.4396 553.2547
#> [129] 459.6384 409.4199 354.3172 385.6255
#> 
#> $n_ahead
#> [1] 12
#> 
#> $model_spec
#> [1] "ESN({52, 1, 0.95}, {104, 17.33})"
#> 
#> attr(,"class")
#> [1] "forecast_esn"

# Plot forecast and test data
plot(xfcst, test = xtest)

Plot forecast and test data