This function introduces a complement statistical test for distinguishing between the predictive accuracy of two sets of forecasts. We propose a non-parametric test founded upon the principles of the Kolmogorov-Smirnov (KS) test, referred to as the KS Predictive Accuracy (KSPA) test. The KSPA test is able to serve two distinct purposes. Initially, the test seeks to determine whether there exists a statistically significant difference between the distribution of forecast errors, and secondly it exploits the principles of stochastic dominance to determine whether the forecasts with the lower error also reports a stochastically smaller error than forecasts from a competing model, and thereby enables distinguishing between the predictive accuracy of forecasts.
KSPA(Error1, Error2, method = c("abs", "sqe", "biqc"))Draw histograms for the forecast errors from each model.
Plot the cdf of forecast errors from each model.
And a list.
One-sided KSPA test
Two-sided KSPA test.
the forecast errors from model 1.
the forecast errors from model 2.
character string specifying the used loss function (abs as absolute errors, sqe as square errors, or biqc as fourth power of errors).
Hossein Hassani and Emmanuel Sirimal Silva and Leila Marvian Mashhad.
Input the forecast errors from two models. Let Error1 show errors from the model with the lower error based on some loss function.
Hassani, H., & Silva, E. S. (2015). A Kolmogorov-Smirnov based test for comparing the predictive accuracy of two sets of forecasts. Econometrics, 3(3), 590-609.
x <- rnorm(40); y <- runif(30)
KSPA(x, y, method = "sqe")
Run the code above in your browser using DataLab