@@ -313,7 +313,7 @@ end example_ILITest9
313
313
*/
314
314
@ main def example_ILITest10 (): Unit =
315
315
316
- import AR .hp
316
+ import MakeMatrix4TS .hp
317
317
318
318
val exo_vars = Array (" %WEIGHTED ILI" , " %UNWEIGHTED ILI" )
319
319
val (xe, y) = loadData (exo_vars, response)
@@ -325,7 +325,6 @@ end example_ILITest9
325
325
val pp = 1.5
326
326
hp(" p" ) = p // endo lags
327
327
hp(" q" ) = q // exo lags
328
- hp(" pp" ) = pp // power to raise lags to
329
328
hp(" spec" ) = 1 // trend specification: 0, 1, 2, 3, 5
330
329
hp(" lwave" ) = 20 // wavelength (distance between peaks)
331
330
hp(" cross" ) = 1
@@ -364,3 +363,107 @@ end example_ILITest9
364
363
365
364
end example_ILITest10
366
365
366
+ // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
367
+ /** The `example_ILITest10` main function test the `Example_ILI` object.
368
+ * This test compares the several models for several values of p and q.
369
+ * > runMain scalation.modeling.forecasting.example_ILITest11
370
+ */
371
+ @ main def example_ILITest11 (): Unit =
372
+
373
+ import MakeMatrix4TS .hp
374
+
375
+ // val exo_vars = Array ("%WEIGHTED ILI", "%UNWEIGHTED ILI")
376
+ val exo_vars = Array (" OT" )
377
+
378
+ val (xe, y) = loadData (exo_vars, response)
379
+ println (s " xe.dims = ${xe.dims}, y.dim = ${y.dim}" )
380
+
381
+ val hh = 6 // maximum forecasting horizon
382
+ val p = 6
383
+ val q = 6
384
+ hp(" p" ) = p // endo lags
385
+ hp(" q" ) = q // exo lags
386
+ hp(" spec" ) = 1 // trend specification: 0, 1, 2, 3, 5
387
+ hp(" lwave" ) = 20 // wavelength (distance between peaks)
388
+ hp(" cross" ) = 0
389
+ hp(" lambda" ) = 1.0
390
+
391
+
392
+ banner(" RandomWalkS" )
393
+ val mod1 = RandomWalkS (y, hh) // create model for time series data
394
+ banner(s " In-ST Forecasts: ${mod1.modelName} on ILI Dataset " )
395
+ mod1.trainNtest()() // train and test on full dataset
396
+ mod1.forecastAll() // forecast h-steps ahead (h = 1 to hh) for all y
397
+ mod1.diagnoseAll(mod1.getY, mod1.getYf)
398
+
399
+ println(" rollValidate" )
400
+ mod1.setSkip(0 )
401
+ mod1.rollValidate() // TnT with Rolling Validation
402
+ mod1.diagnoseAll(mod1.getY, mod1.getYf, Forecaster .teRng(y.dim), 0 )
403
+
404
+
405
+ banner(" AR" )
406
+ val mod2 = AR (y, hh) // create model for time series data
407
+ banner(s " In-ST Forecasts: ${mod2.modelName} on ILI Dataset " )
408
+ mod2.trainNtest()() // train and test on full dataset
409
+ mod2.forecastAll() // forecast h-steps ahead (h = 1 to hh) for all y
410
+ mod2.diagnoseAll(mod2.getY, mod2.getYf)
411
+
412
+ println(" rollValidate" )
413
+ mod2.setSkip(0 )
414
+ mod2.rollValidate() // TnT with Rolling Validation
415
+ mod2.diagnoseAll(mod2.getY, mod2.getYf, Forecaster .teRng(y.dim), 0 )
416
+
417
+
418
+ banner(" ARX" )
419
+ val mod3 = ARX (xe, y, hh) // create model for time series data
420
+ banner(s " In-ST Forecasts: ${mod3.modelName} on ILI Dataset " )
421
+ mod3.trainNtest_x()() // train and test on full dataset
422
+ mod3.forecastAll() // forecast h-steps ahead (h = 1 to hh) for all y
423
+ mod3.diagnoseAll(mod3.getY, mod3.getYf)
424
+
425
+ println(" rollValidate" )
426
+ mod3.setSkip(0 )
427
+ mod3.rollValidate() // TnT with Rolling Validation
428
+ mod3.diagnoseAll(mod3.getY, mod3.getYf, Forecaster .teRng(y.dim), 0 )
429
+
430
+
431
+ banner(" ARX_D" )
432
+ val mod4 = ARX_D (xe, y, hh) // create model for time series data
433
+ banner(s " In-ST Forecasts: ${mod4.modelName} on ILI Dataset " )
434
+ mod4.trainNtest_x()() // train and test on full dataset
435
+ mod4.forecastAll() // forecast h-steps ahead (h = 1 to hh) for all y
436
+ mod4.diagnoseAll(mod4.getY, mod4.getYf)
437
+
438
+ println(" rollValidate" )
439
+ mod4.setSkip(0 )
440
+ mod4.rollValidate() // TnT with Rolling Validation
441
+ mod4.diagnoseAll(mod4.getY, mod4.getYf, Forecaster .teRng(y.dim), 0 )
442
+
443
+
444
+ banner(" ARX_Quad" )
445
+ val mod5 = ARX_Quad (xe, y, hh) // create model for time series data
446
+ banner(s " In-ST Forecasts: ${mod5.modelName} on ILI Dataset " )
447
+ mod5.trainNtest_x()() // train and test on full dataset
448
+ mod5.forecastAll() // forecast h-steps ahead (h = 1 to hh) for all y
449
+ mod5.diagnoseAll(mod5.getY, mod5.getYf)
450
+
451
+ println(" rollValidate" )
452
+ mod5.setSkip(0 )
453
+ mod5.rollValidate() // TnT with Rolling Validation
454
+ mod5.diagnoseAll(mod5.getY, mod5.getYf, Forecaster .teRng(y.dim), 0 )
455
+
456
+
457
+ banner(" ARX_Quad_D" )
458
+ val mod6 = ARX_Quad_D (xe, y, hh) // create model for time series data
459
+ banner(s " In-ST Forecasts: ${mod6.modelName} on ILI Dataset " )
460
+ mod6.trainNtest_x()() // train and test on full dataset
461
+ mod6.forecastAll() // forecast h-steps ahead (h = 1 to hh) for all y
462
+ mod6.diagnoseAll(mod6.getY, mod6.getYf)
463
+
464
+ println(" rollValidate" )
465
+ mod6.setSkip(0 )
466
+ mod6.rollValidate() // TnT with Rolling Validation
467
+ mod6.diagnoseAll(mod6.getY, mod6.getYf, Forecaster .teRng(y.dim), 0 )
468
+
469
+ end example_ILITest11
0 commit comments