cw_test: Clark-West Test for Predictive Ability of Nested Models

View source: R/cw-test.R

cw_testR Documentation

Clark-West Test for Predictive Ability of Nested Models

Description

Tests whether an alternative (unrestricted) model has superior out-of-sample predictive ability relative to a benchmark (restricted) model, using the MSFE-adjusted statistic of Clark and West (2007). Also computes the out-of-sample R^2_{OS} statistic.

Usage

cw_test(e1, e2, f1, f2)

Arguments

e1

Numeric vector of forecast errors from the benchmark (restricted/null) model.

e2

Numeric vector of forecast errors from the alternative (unrestricted) model.

f1

Numeric vector of forecasts from the benchmark model.

f2

Numeric vector of forecasts from the alternative model.

Details

The MSFE-adjusted series is defined as:

\hat{f}_t = e_{1,t}^2 - \left(e_{2,t}^2 - (f_{1,t} - f_{2,t})^2\right)

The test regresses \hat{f}_t on a constant and uses the resulting t-statistic, compared to a standard normal distribution (one-sided).

Value

A list with class "cw_test" containing:

statistic

The Clark-West t-statistic.

pvalue

One-sided p-value (H1: alternative is better).

r2os

Out-of-sample R^2_{OS} in percent.

n

Number of observations.

References

Clark, T.E. and West, K.D. (2007). Approximately Normal Tests for Equal Predictive Accuracy in Nested Models. Journal of Econometrics, 138(1), 291-311.

Examples

set.seed(42)
n <- 200
actual <- rnorm(n)
f1 <- actual + rnorm(n, sd = 0.5)
f2 <- actual + rnorm(n, sd = 0.4)
e1 <- actual - f1
e2 <- actual - f2
cw_test(e1, e2, f1, f2)


forecastdom documentation built on Nov. 2, 2026, 1:10 a.m.