backshift 0.3.0

Time-series forecasting checked against R and statsmodels: ARIMA, ETS, Theta, VAR, Croston/TSB, GARCH and changepoint detection, with streaming filters that run without a heap
Documentation
//! R reference vectors for the accuracy and cross-validation conformance tests.
//!
//! Generated by `scripts/generate_r_accuracy_reference.R` with R version 4.4.2 (2024-10-31) and forecast 8.23.0.
//! Do not edit by hand; rerun the script instead.

/// A training series (monthly), the values after it, a forecast of them, and
/// `accuracy(forecast, test)`: ME, RMSE, MAE, MPE, MAPE, and MASE scaled by the training
/// series' seasonal naive error, as `accuracy(forecast_object, test)` scales it.
pub struct AccuracyCase {
    /// The training values.
    pub training: &'static [f64],
    /// The season length.
    pub period: usize,
    /// The values the forecast is scored against.
    pub test: &'static [f64],
    /// The forecast.
    pub forecast: &'static [f64],
    /// ME, RMSE, MAE, MPE, MAPE and MASE.
    pub metrics: [f64; 6],
}

/// The accuracy case.
pub const ACCURACY: AccuracyCase = AccuracyCase {
    training: &[
        98.74738799243467,
        103.77983470874071,
        108.30287292173401,
        110.52583670369664,
        110.20601876752085,
        107.36461421566213,
        102.39439642093977,
        98.35983352003859,
        93.64280454517743,
        92.34919296011495,
        92.67163908384026,
        97.48595991957302,
        101.65247362165024,
        107.40548686108903,
        111.39548666541066,
        110.72073378159239,
        110.61072729372668,
        105.86097824443625,
        101.81068847358777,
        98.85560730043926,
        94.99743542332797,
        93.3847387278405,
        93.94499930699898,
        95.13298833279846,
        102.37231205440462,
        107.90972161665357,
        113.64821517852215,
        115.43550305020898,
        114.39501294404182,
        112.33399981196843,
        112.32203837573454,
        106.38778961283525,
        104.02622877427457,
        103.13872767221467,
        104.5184163879958,
        112.06640840170951,
        116.14363045032937,
        119.78686265061879,
        124.22292716915271,
        125.12577837609246,
        126.14829590403804,
        125.0642489772566,
        121.59685036713981,
        117.96302137529875,
        114.89051776470728,
        115.18504469487611,
        117.87599454262839,
        120.49174575763764,
        122.41678134162785,
        125.9352752612022,
        128.7828823339642,
        131.68490142661832,
        131.36547403622654,
        130.6977147251952,
        127.32723972204671,
        123.93699965427216,
        120.25193536021384,
        121.16778460703578,
        123.06124171668083,
        127.66444434897197,
        131.79893887940744,
        137.28797688597194,
        141.87694440555455,
        142.90662713267517,
        142.7571451247645,
        142.0666875861013,
        139.12784208006332,
        135.50043321269686,
        134.59241024683575,
        133.9274758500151,
        136.31364883549296,
        141.4846579472108,
        144.63066659790476,
        148.4031697449413,
        151.09563804211936,
        154.6483915807374,
        154.7848926500314,
        153.00354523248308,
        150.25034227605647,
        145.97728609424016,
        139.65978951799747,
        139.13337741336719,
        142.19160943643902,
        143.83484387814661,
    ],
    period: 12,
    test: &[
        147.64783849647696,
        152.04829754165905,
        155.93293408621898,
        156.66016819644102,
        156.20984905155245,
        155.2207826469689,
        151.68009577028027,
        146.8598698185138,
        144.4071354877969,
        143.3762775173839,
        144.45128627348848,
        146.27237730456946,
    ],
    forecast: &[
        145.13066659790476,
        148.9031697449413,
        151.59563804211936,
        155.1483915807374,
        155.2848926500314,
        153.50354523248308,
        150.75034227605647,
        146.47728609424016,
        140.15978951799747,
        139.63337741336719,
        142.69160943643902,
        144.33484387814661,
    ],
    metrics: [
        2.262779977240496,
        2.598727198205208,
        2.262779977240496,
        1.5155295686364414,
        1.5155295686364414,
        0.2905844122067544,
    ],
};

/// `tsCV(values, rwf, h = 3, initial = 10)`: row `t` holds the errors of the naive
/// forecasts from the first `t + 1` values, at horizons 1 to 3 (`NaN` where none exists).
pub struct CrossValidationCase {
    /// The series.
    pub values: &'static [f64],
    /// The errors, row-major: one row of 3 per value.
    pub errors: &'static [f64],
}

/// The cross-validation case.
pub const CROSS_VALIDATION: CrossValidationCase = CrossValidationCase {
    values: &[
        98.74738799243467,
        103.77983470874071,
        108.30287292173401,
        110.52583670369664,
        110.20601876752085,
        107.36461421566213,
        102.39439642093977,
        98.35983352003859,
        93.64280454517743,
        92.34919296011495,
        92.67163908384026,
        97.48595991957302,
        101.65247362165024,
        107.40548686108903,
        111.39548666541066,
        110.72073378159239,
        110.61072729372668,
        105.86097824443625,
        101.81068847358777,
        98.85560730043926,
        94.99743542332797,
        93.3847387278405,
        93.94499930699898,
        95.13298833279846,
        102.37231205440462,
        107.90972161665357,
        113.64821517852215,
        115.43550305020898,
        114.39501294404182,
        112.33399981196843,
        112.32203837573454,
        106.38778961283525,
        104.02622877427457,
        103.13872767221467,
        104.5184163879958,
        112.06640840170951,
        116.14363045032937,
        119.78686265061879,
        124.22292716915271,
        125.12577837609246,
    ],
    errors: &[
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        4.814320835732758,
        8.980834537809983,
        14.73384777724877,
        4.166513702077225,
        9.919526941516011,
        13.909526745837638,
        5.753013239438786,
        9.743013043760413,
        9.068260159942142,
        3.989999804321627,
        3.3152469205033555,
        3.205240432637652,
        -0.6747528838182717,
        -0.7847593716839754,
        -5.534508420974404,
        -0.11000648786570366,
        -4.859755537156133,
        -8.910045308004612,
        -4.749749049290429,
        -8.800038820138909,
        -11.755119993287423,
        -4.0502897708484795,
        -7.005370943996994,
        -10.863542821108283,
        -2.955081173148514,
        -6.813253050259803,
        -8.425949745747275,
        -3.858171877111289,
        -5.470868572598761,
        -4.91060799344028,
        -1.6126966954874717,
        -1.052436116328991,
        0.1355529094704906,
        0.5602605791584807,
        1.7482496049579623,
        8.987573326564117,
        1.1879890257994816,
        8.427312747405637,
        13.96472230965459,
        7.239323721606155,
        12.776733283855108,
        18.51522684572369,
        5.537409562248953,
        11.275903124117534,
        13.063190995804362,
        5.73849356186858,
        7.525781433555409,
        6.4852913273882535,
        1.7872878716868286,
        0.7467977655196734,
        -1.314215366553725,
        -1.0404901061671552,
        -3.1015032382405536,
        -3.113464674474443,
        -2.0610131320733984,
        -2.0729745683072878,
        -8.007223331206575,
        -0.011961436233889344,
        -5.946210199133176,
        -8.307771037693854,
        -5.934248762899287,
        -8.295809601459965,
        -9.183310703519865,
        -2.3615608385606777,
        -3.249061940620578,
        -1.8693732248394497,
        -0.8875011020599004,
        0.492187613721228,
        8.040179627434938,
        1.3796887157811284,
        8.927680729494838,
        13.004902778114698,
        7.54799201371371,
        11.62521406233357,
        15.268446262622987,
        4.077222048619859,
        7.720454248909277,
        12.156518767443202,
        3.643232200289418,
        8.079296718823343,
        8.982147925763087,
        4.436064518533925,
        5.338915725473669,
        f64::NAN,
        0.9028512069397436,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
        f64::NAN,
    ],
};