Learn R Programming

pEPA (version 1.0)

csc.test: Computes Test for Cross-Sectional Clusters.

Description

This function computes test of the equal predictive accuracy for cross-sectional clusters. The null hypothesis of this test is that a pair of forecasts have the same expected accuracy among cross-sectional clusters. However, their predictive accuracy can be different across the clusters, but the same among each cluster. The test is suitable if either: \(K \ge 2\) and significance level \(\le 0.08326\), or \(2 \le K \le 14\) and significance level \(\le 0.1\), or \(K = \{ 2,3 \} \) and significance level \(\le 0.2\), where \(K\) denotes the number of time clusters.

Usage

csc.test(evaluated1,evaluated2,realized,loss.type="SE",cl,dc=FALSE)

Value

class htest object, list of

statistic

test statistic

parameter

\(K\), number of cross-sectional clusters

alternative

alternative hypothesis of the test

p.value

p-value

method

name of the test

data.name

names of the tested data

Arguments

evaluated1

same as in pool_av.test, but cross-sections are ordered rowwise

evaluated2

same as in pool_av.test, but cross-sections are ordered rowwise

realized

same as in pool_av.test, but cross-sections are ordered rowwise

loss.type

same as in pool_av.test

cl

vector of the beginning indices of rows for each pre-defined clusters -- as a result always cl[1]=1

dc

logical indicating if apply decorrelating clusters, if not specified dc=FALSE is used

References

Qu, R., Timmermann, A., Zhu, Y. 2024. Comparing forecasting performance with panel data. International Journal of Forecasting 40, 918--941.

See Also

pool_av.test

Examples

Run this code
data(forecasts)
y <- t(observed)
f.bsr <- matrix(NA,ncol=ncol(y),nrow=56)
f.dma <- f.bsr
# extract prices predicted by BSR rec and DMA methods
for (i in 1:56)
  {
    f.bsr[i,] <- predicted[[i]][,1]
    f.dma[i,] <- predicted[[i]][,9]
  }
# 2 cross-sectional clusters: energy commodities and non-energy commodities
cs.cl <- c(1,9)
t <- csc.test(evaluated1=f.bsr,evaluated2=f.dma,realized=y,loss.type="SE",cl=cs.cl)

Run the code above in your browser using DataLab