# cs_dispersion: Compute Cross-Sectional Dispersion In ceweiss/GeomComb: Forecast Combination Methods

## Description

Computes (time-varying) dispersion measures for the cross section of individual model forecasts that are the input of forecast combination.

## Usage

 1 cs_dispersion(x, measure = "SD", plot = FALSE) 

## Arguments

 x An object of class foreccomb. Contains training set (actual values + matrix of model forecasts) and optionally a test set. measure Cross-sectional dispersion measure, one of: "SD" = standard deviation (default); "IQR" = interquartile range; or "Range" = range. plot logical. If TRUE, evolution of cross-sectional forecast dispersion is plotted as ggplot.

## Details

The available measures of scale are defined as in Davison (2003). Let y_(i) denote the i-th order statistic of the sample, then:

Range_t = y_{(n), t} - y_{(1), t}

IQR_t = y_{(3n/4),t} - y_{(n/4),t}

SD_t = sqrt(1/(n-1) Σ_{i=1}^n (y_{i,t} - \bar{y}_t))

Previous research in the forecast combination literature has documented that regression-based combination methods tend to have relative advantage when one or more individual model forecasts are better than the rest, while eigenvector-based methods tend to have relative advantage when individual model forecasts are in the same ball park.

## Value

Returns a vector of the evolution of cross-sectional dispersion over the sample period (using the selected dispersion measure)

## References

Davison, A. C. (2003). Statistical Models. Cambridge University Press.

Hsiao, C., and Wan, S. K. (2014). Is There An Optimal Forecast Combination? Journal of Econometrics, 178(2), 294–309.

foreccomb, sd, IQR, range
 1 2 3 4 5 6 7 8 9 obs <- rnorm(100) preds <- matrix(rnorm(1000, 1), 100, 10) train_o<-obs[1:80] train_p<-preds[1:80,] test_o<-obs[81:100] test_p<-preds[81:100,] data<-foreccomb(train_o, train_p, test_o, test_p) cs_dispersion(data, measure = "IQR")