BacktestDensity: Backtest a series of one-step ahead density predictions.

Description Usage Arguments Details Value Author(s) References Examples

View source: R/BackTest.R

Description

The BacktestDensity() function accepts an object of the class uGASRoll, and returns a list with two elements: (i) the averages Negative Log Score (NLS) and weighted Continuous Ranked Probability Score (wCRPS) introduced by Gneiting and Ranjan (2012), and (ii) their values at each point in time. The wCRPS is evaluated using 5 weight functions, see Details.

Usage

1
BacktestDensity(Roll, lower, upper, K = 1000, a = NULL, b = NULL)

Arguments

Roll

an object of the class uGASRoll.

lower

numeric the lower bound used to approximate the wCRSP by Monte Carlo integration as detailed in Gneiting and Ranjan (2012). This coincides with y_{l} in Equation 16 of Gneiting and Ranjan (2012).

upper

numeric the upper bound used to approximate the wCRSP by Monte Carlo integration as detailed in Gneiting and Ranjan (2012). This coincides with y_{u} in Equation 16 of Gneiting and Ranjan (2012).

K

numeric integer representing the number of points used to discretize the wCRPS integral. This is I in Equation 16 of Gneiting and Ranjan (2012). By default K = 1000.

a

numeric. mean of the normal distribution used in the weight function. By default a = NULL, which means that it is set equal to the empircial mean of the in sample observations.

b

numeric. standard deviation of the normal distribution used in the weight function. By default b = NULL, which means that it is set equal to the empircial standard deviation of the in sample observations.

Details

The average Negative Log Score (NLS) is computed as the negative of the average of the log scores evaluated during the out-of-sample period. The average weighted Continuous Ranked Probability Score (wCRPS) is computed as the average of the wCRPS evaluated during the out-of-sample period, see Gneiting and Ranjan (2012).
The wCRPS is evaluated using Equation 16 of Gneiting and Ranjan (2012). The weights functions implemented are:

where φ_{a,b}(z) and Φ_{a,b}(z) are the pdf and cdf of a Gaussian distribution with mean a and standard deviation b, respectively. The label "Uniform" represents the case where equal emphasis is given to all the parts of the distribution.

Value

A list with elements: average, series. The element "average" is a named vector with the averages NLS and wCRSP. The element "series" is a list: the fist element, LS, contains the out-of-sample Log Score (not with the negative sign), the second element, WCRPS, contains a matrix with the wCRPS series. The columns of this matrix are named: "uniform", "center", "tails", "tail_r", "tail_l", which are associated with the wCRSP with emphasis on: Uniform, Center, Tails, Right tail and Left tail, respectively.

Author(s)

Leopoldo Catania

References

Gneiting T, Ranjan R (2011). "Comparing Density Forecasts using Threshold -and Quantile-Weighted Scoring Rules." Journal of Business & Economic Statistics, 29(3), 411-422. doi: 10.1198/jbes.2010.08110.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
data("cpichg")

GASSpec = UniGASSpec(Dist = "std", ScalingType = "Identity",
                       GASPar = list(location = TRUE, scale = TRUE,
                                      shape = FALSE))

Roll = UniGASRoll(cpichg, GASSpec, ForecastLength = 50,
                  RefitEvery = 10, RefitWindow = c("moving"))

BackTest = BacktestDensity(Roll, lower = -100, upper = 100)

BackTest$average

## End(Not run)

GAS documentation built on Feb. 4, 2022, 5:12 p.m.