knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-" )
The MultiHorizonSPA
package allows R users to run the Multi Horizon Superior Predictive Ability (SPA) test proposed by Quaedvlieg (2021): compare the predictive performance of two distinct models when jointly considering all horizons of a forecast path.
You can install MultiHorizonSPA
from CRAN as follows:
install.packages("MultiHorizonSPA")
or from GitHub:
install.packages("devtools") devtools::install_github("lucabarbaglia/MultiHorizonSPA")
Test for uniform SPA (uSPA).
library(MultiHorizonSPA) data(LossDiff_uSPA) Test_uSPA(LossDiff=LossDiff_uSPA, L=3)
The output of the Test_uSPA
function is a list containing two objects:
p-value: the p-value for uSPA;
t_uSPA: the statistics for uSPA;
Now test for average SPA (aSPA).
library(MultiHorizonSPA) data(LossDiff_aSPA) weights <- t(as.matrix(rep(1, ncol(LossDiff_aSPA))/ncol(LossDiff_aSPA))) Test_aSPA(LossDiff=LossDiff_aSPA, weights=weights, L=3)
The output of the Test_aSPA
function is a list containing two objects:
p-value: the p-value for aSPA;
t_aSPA: the statistics for aSPA.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.