statsmodels.stats.diagnostic.pesaran_timmermann#
- statsmodels.stats.diagnostic.pesaran_timmermann(actual, predicted, alternative='two-sided')[source]#
Pesaran-Timmermann test of directional predictive accuracy.
- Parameters:
- actualarray_like
Realized values. The direction is classified by
actual > 0.- predictedarray_like
Forecasted or predicted values. The direction is classified by
predicted > 0.- alternative{“two-sided”, “larger”, “smaller”}
Alternative hypothesis for the directional accuracy statistic.
- Returns:
PesaranTimmermannResultA NamedTuple with fields:
- statisticfloat
Normal test statistic.
- pvaluefloat
P-value for the chosen alternative.
- res_storeResultsStore or None
Intermediate results.
Notes
The Pesaran-Timmermann test evaluates whether the realized and predicted signs are independent. Let
\[\hat{p} = n^{-1}\sum_{t=1}^n 1\{\operatorname{sign}(y_t) = \operatorname{sign}(\hat{y}_t)\}\]be the observed success rate, and let
\[\hat{p}_* = \hat{p}_y \hat{p}_z + (1 - \hat{p}_y)(1 - \hat{p}_z)\]denote the success rate implied by independence, where \(\hat{p}_y\) and \(\hat{p}_z\) are the sample proportions of positive realizations and positive predictions. The test statistic is
\[S_n = \frac{\hat{p} - \hat{p}_*} {\sqrt{\hat{v} - \hat{w}}},\]where
\[\hat{v} = \hat{p}_* (1 - \hat{p}_*) / n\]and
\[\hat{w} = \left[(2\hat{p}_y - 1)^2 \hat{p}_z (1 - \hat{p}_z) + (2\hat{p}_z - 1)^2 \hat{p}_y (1 - \hat{p}_y)\right] / n.\]Under the null of no directional predictive ability, the statistic is asymptotically standard normal.
References
[1]Pesaran, M. H., and Timmermann, A. “A Simple Nonparametric Test of Predictive Performance.” Journal of Business & Economic Statistics 10, no. 4 (1992): 461-465.