Skip to content

Reality Check Tests

Pedro Albuquerque edited this page Nov 8, 2016 · 21 revisions

Hansen's Test of Superior Predictive Ability (SPA).

When testing for Superior Predictive Ability (SPA), the question of interest is whether any alternative forecast is better than the benchmark forecast or, equivalently, whether the best alternative forecasting model is better than the benchmark.

In this sense Hansen, P. R. (2005) proposed a Superior Predictive Ability test which is more powerful and less sensitive to the inclusion of poor and irrelevant alternatives as the White, H. (2000) Reality Check.

The Hansen's Test of Superior Predictive Ability can be addressed by testing the null hypothesis that "the benchmark is not inferior to any alternative forecast". This testing problem is relevant for applied econometrics, because several ideas and specifications are often used before a model is selected.

Testing for Superior Predictive Ability (SPA).

We consider a situation where a decision must be made equation periods in advance and let equation be a finite set of possible decision rules. Decisions are evaluated with a real valued loss function, equation where equation random variable that represents the aspects of the decision problem that are unknown at the time that the decision is made. We evaluate fore casts in terms of their expected loss, equation.

Our leading example is the comparison of forecasts, so we often refer to equation as the k-th forecasting model. The first model, equation, has a special role and is referred to as the benchmark.

The decision rule equation can represent a point forecast, an interval forecast, a density forecasts, or a trading rule for an investor [Hansen, P. R. (2005)].

The most common use of the Hansen, P. R. (2005) Superior Predictive Ability Test is considerate equation as a binary variable binary variable that instructs a trader to take either a short (equation) (i.e., short position, is a directional trading or investment strategy where the investor sells shares of borrowed stock in the open market.) or a long (equation) position in an asset at time equation (i.e. long position is the buying of a security such as a stock, commodity or currency with the expectation the asset will rise in value.). The k-th trading rule yields the profit equation, where equation is the return on the asset in period t.

A trader who is currently using the rule, equation, might be interested to know whether an alternative rule has a larger expected profit than equation. This can be formulated in our framework by setting equation and equation.

In this case, the benchmark could be equation which is the rule that is always "long in the market." This was the bench mark used by Sullivan et al. (1999, 2001) who evaluated the significance of technical trading rules and calendar effects in stock returns.

We are interested to know whether any of the models, k=1,...,m, are better than the benchmark in terms of expected loss. So we seek a test of the null hypothesis that the benchmark is not inferior to any of the alternatives. The variables that are key for our analysis are the relative performance variables, which are defined by:

equation.

So equation denotes the performance of model k relative to the benchmark at time t, and we stack these variables into the vector of relative performances, equation. Provided that equation is well defined, we can now formulate the null hypothesis of interest as:

equation

It is important to note that Hansen, P. R. (2005) works under the assumption that model k is better than the benchmark if and only if equation. So we focus exclusively on the properties of equation for t=1,...,n and abstract entirely from all aspects that relate to the construction of the equation-variables.

The Hansen, P. R. (2005) Superior Predictive Ability Test assumes that equation is (strictly) stationary and second finite moment (to be possible to apply the Central Limit Theorem).

In this case the the asymptotic null distribution is:

equation

At this point, all essential aspects of our framework are identical to those of White, H. (2000) Reality Check (RC). White, H. (2000) proceeded by constructing the RC from the test statistic:

equation

where equation is the sample mean associated with the k-th model and equation is consistent estimator of the variance and covariance matrix.

Hansen, P. R. (2005) suggests:

  1. Use the studentized test statistic:

equation

  1. Invoke a null distribution that is based on

equation where: equation

where 1 is the indicator function and equation is some consistent estimator.

The Hansen, P. R. (2005) Superior Predictive Ability Test is usually implemented using the stationary bootstrap of Politis and Romano (1994). The stationary bootstrap of Politis and Romano (1994) is based on pseudo-time series of the original data. The pseudo time series equation for b=1,...,B are resamples of equation where equation is constructed by combining blocks of {1,..., n} with random lengths.

The leading case is that where the block length is chosen to be geometrically distributed with parameter equation, but the block length may be randomized differently, as discussed by Politis and Romano (1994). The number of bootstrap resamples B, should be chosen to be sufficiently large such that the results are not affected by the actual draws of equation.

Here we follow the conventional setup of the stationary bootstrap and generate B resamples from two random B x n matrices U and V, where the elements? equation, are independent and uniformly distributed on (0,1]. The first element of each resample is defined by equation where equation is the smallest integer that is larger than or equal to x. For t=2,...,n the elements are given recursively by:

  • equation if equation
  • equation if equation.

So with probability q, the t-th element is chosen uniformly on {1, ..., n} and with probability 1-q, the t-th element is chosen to be the integer that follows equation unless equation in which case equation. The block bootstrap is very similar to the stationary bootstrap, but instead of using blocks with random length, the block bootstrap combines blocks of equal length.

From the pseudo-time series, we calculate their sample averages:

equation

that can be viewed as (asymptotically) independent draws from the distribution of equation, under the bootstrap distribution. So this provides an intermediate step to estimate the distribution of Hansen's test statistic.

Hansen, P. R. (2005) suggested construct the centered matrix with elements equal to:

equation

for b=1,...,B and t=1,...,n. The equation can be:

  1. equation.
  2. equation.
  3. equation.

for i=l,c or u. Hansen's test statistics under the null hypothesis by the empirical distribution we obtain from the bootstrap resamples equation. The p-values of the three tests for SPA are now simple to obtain. We calculate:

equation

for b=1,...,B and the bootstrap p-value is given by:

equation

where the null hypothesis should be rejected for small p-values.

Using the hansen.spa function.

Here an example how to use the hansen.spa function.

#Clean the R's workspace
rm(list=ls())
#Invoke the libraries
library(mlRFinance)
#Generate some fake relative performance variables (NxK)
D<-matrix(runif(10000,-1,+1),ncol=10,nrow = 10)
#Generate the relative performance benchmark
b<-runif(1000,-1,+1)
#Call the function 
hansen.spa(Dmat=D,bVec=b,typeFunc=1,B=500,geomMean=20)

We can use the same idea to test for the White, H. (2000) Reality Check:

#Clean the R's workspace
rm(list=ls())
#Invoke the libraries
library(mlRFinance)
#Generate some fake relative performance variables (NxK)
D<-matrix(runif(10000,-1,+1),ncol=10,nrow = 10)
#Generate the relative performance benchmark
b<-runif(1000,-1,+1)
#Call the function 
white.spa(Dmat=D,bVec=b,typeFunc=1,B=500,geomMean=20)

Diebold and Mariano Test for Equal Predictive Ability (EPA)

Whereas the frameworks of Diebold and Mariano (2012) and West (1996) involve tests for EPA, the testing problem in White, H. (2000) framework is a test for SPA. The distinction is important because the former leads to a simple null hypothesis, whereas the latter leads to a composite hypothesis.

The basic idea is compare the expected loss based on the model forecast and some benchmark model. The input must be two vectors equation representing the estimated loss for these two models.

The DM Statistic can be used with a wide variety of accuracy measures (in particular, the loss function need not be quadratic and need not even be symmetric), and forecast errors can be non-Gaussian, nonzero mean, serially correlated, and contemporaneously correlated.

The DM Statistic is given by:

equation

where

equation

and

equation

where equation are the sample variance and auto-covariance, respectively. Usually, we use equation. Under the null hypothesis equation.

Harvey, Leybourne, and Newbold (1997) suggested a modification of the Diebold and Mariano (2012) test that leads to better small-sample properties.

This statistic is given by:

equation.

Under the null hypothesis this statistic follow a T-student with T-1 degrees of freedom.

Hansen, P. R. (2005) suggests that the Diebold and Mariano (2012) can be used to test multiple hypothesis since the analyst use some correction as, for example, the Bonferroni correction.

To use the DM functions we can simple do:

#Clean the R's workspace
rm(list=ls())
#Invoke the libraries
library(mlRFinance)
#Generate some fake loss results
model <-runif(1000,-1,1)
bench <-ruinf(1000,-1,1)
#Call the function 
DM.epa(e.model=model, e.bench=bench)
#Corrected DM
DM.epa.corrected(e.model=model, e.bench=bench)

Clone this wiki locally