| cw_test | R Documentation |
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.
cw_test(e1, e2, f1, f2)
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. |
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).
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 |
n |
Number of observations. |
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.