MultiHorizonMCS: Multihorizon model confidence set and p-values

Description Usage Arguments Value Examples

View source: R/MultiHorizonMCS.R

Description

Produces Multi-Horizon Model Confidence Set and p-values as described in section 2.2. of Quadvlieg (2021).

Usage

1
2
3
4
5
6
7
8
9
MultiHorizonMCS(
  Losses,
  alpha_t = 0.05,
  alpha_mcs = 0.05,
  weights = NULL,
  L,
  B = 999,
  unif_or_average = "u"
)

Arguments

Losses

A list containing M matrices of dimension T by H. Each matrix contains the losses for a forecasting method. Rows correspond to time periods (T rows), columns correspond to forecast horizons (H columns).

alpha_t

Alpha level of critical values for pairwise tests. See Quadvlieg (2021).

alpha_mcs

Alpha level of the critical value for the MCS test. Denoted by alpha tilde in Quadvlieg (2021) section 2.2

weights

the 1 x H vector of weights for the losses at different horizons. For instance weights <- matlab::ones(1,20)/20

L

integer, the parameter for the moving block bootstrap

B

integer, the number of bootstrap iterations. Default 999

unif_or_average

If equals "a", then the confidence set is calculated based on average SPA. If equals "u", then the confidence set is calculated based on uniform SPA.

Value

Returns a list of length 2. The elements of the list are:

MCS_set

A M by 2 matrix. The first column contains the indices of the methods for which the p-value is greater than or equal to 1-alpha_mcs. The second column contains the p-values that are greater than or equal to 1-alpha_mcs.

p_values

A vector containing the p-values for all methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
Trow <- 20 
H <- 12
Mmethods <- 9
weights <- rep(1/H,H)

loss_list <- vector(mode = "list", length = Mmethods)

loss_list[[1]] <- matrix(rnorm(Trow*H, mean = 1), nrow = Trow, ncol = H)
loss_list[[2]] <- matrix(rnorm(Trow*H, mean = 2), nrow = Trow, ncol = H)
loss_list[[3]] <- matrix(rnorm(Trow*H, mean = 3), nrow = Trow, ncol = H)
loss_list[[4]] <- matrix(rnorm(Trow*H, mean = 2), nrow = Trow, ncol = H)
loss_list[[5]] <- matrix(rnorm(Trow*H, mean = 1), nrow = Trow, ncol = H)
loss_list[[6]] <- matrix(rnorm(Trow*H, mean = 1), nrow = Trow, ncol = H)
loss_list[[7]] <- matrix(rnorm(Trow*H, mean = 2), nrow = Trow, ncol = H)
loss_list[[8]] <- matrix(rnorm(Trow*H, mean = 3), nrow = Trow, ncol = H)
loss_list[[9]] <- matrix(rnorm(Trow*H, mean = 2), nrow = Trow, ncol = H)
loss_list[[10]] <- matrix(rnorm(Trow*H, mean = 1), nrow = Trow, ncol = H)


MultiHorizonMCS(loss_list, L=3,B=5,unif_or_average = 'u')

lucabarbaglia/MultiHorizonSPA documentation built on Dec. 12, 2021, 5:43 a.m.