size {acrt}R Documentation

Computing the Size of Autocorrelation Robust Tests

Description

This function provides an implementation of Algorithm 2 in Pötscher and Preinerstorfer (2016), which we here abbreviate as (A2). The user is referred to this article for definitions, a detailed description of the problem solved by (A2), and for a detailed description of the algorithm itself.

Usage

size(C, ar.order.max, bandwidth, ker, R, X, N0, N1, N2, Mp, M1, 
               M2, Eicker = FALSE, 
               opt.method.1 = "Nelder-Mead",
               opt.method.2 = "Nelder-Mead", 
               control.1 = list("reltol" = N1^(-.5), "maxit" = dim(X)[1]*20),
               control.2 = list("reltol" = N2^(-.5), "maxit" = dim(X)[1]*30),   
               cores = 1, margin = rep(1, length = ar.order.max))

Arguments

C

Critical value. A positive real number (for negative critical values the size of the test equals 1).

ar.order.max

Maximal order of the stationary autoregressive error process. A nonnegative integer. If ar.order.max is greater than sample size minus one, then ar.order.max is automatically replaced by sample size minus one. If ar.order.max equals sample size minus one, then the size approximated by (A2) is with respect to the set of all stationary Gaussian error processes. If ar.order.max is set equal to 0, size does not return the outcome of (A2), because no optimization is needed in that case. Instead, it draws a pseudorandom sample of size N2 from the distribution of the test statistic under the null hypothesis and returns the fraction of observations that give rise to a test statistic not smaller than the critical value C.

bandwidth

Bandwidth parameter used in the construction of the test statistic. A positive real number.

ker

Kernel function used in the construction of the test statistic. ker can take one of the values "Bartlett", "Parzen", or "Quadratic Spectral". The kweights function is used to generate the weights. For the test statistic T_{w} this implies the weights used via w(j, n) = ker(j/bandwidth). For the test statistic T_{E, \mathsf{W}} this implies the weights matrix \mathsf{W} via \mathsf{W}_{ij} = ker((i-j)/bandwidth), cf. Pötscher and Preinerstorfer (2016) for definitions of T_{w} and T_{E, \mathsf{W}}.

R

The restriction matrix. size computes the size of a test for the hypothesis R β = r. R needs to be of full row rank, and needs to have the same number of columns as X.

X

The design matrix. X needs to be of full column rank. The number of columns of X must be smaller than the number of rows of X.

N0

A positive integer. Corresponds to N_0 in the description of (A2) in Pötscher and Preinerstorfer (2016).

N1

A positive integer. Corresponds to N_1 in the description of (A2) in Pötscher and Preinerstorfer (2016). N1 should be greater than N0.

N2

A positive integer. Corresponds to N_2 in the description of (A2) in Pötscher and Preinerstorfer (2016). N2 should be greater than N1.

Mp

A positive integer. Mp determines M_0 in (A2), i.e., the number of starting values chosen in Stage 0 of (A2). The way initial values are generated depends on ar.order.max:

  1. If ar.order.max is 0 the choice of Mp is irrelevant, see the description of ar.order.max above.

  2. If ar.order.max is either 1 or 2, then the initial values are an i.i.d. pseudorandom sample of size Mp drawn from a distribution on the set of partial autocorrelation coefficients that induces a uniform distribution on the set of stationary autoregressive coefficients of order ar.order.max (cf. Jones (1987)).

  3. If ar.order.max is greater than 2, then starting values are generated as follows: Let A denote the set of integer multiples of 5 that are greater than 2 and smaller than ar.order.max. For every number

    l \in A \cup \{2, ar.order.max\}

    the algorithm in Jones (1987) is used to generate a pseudorandom sample of size Mp on the set of partial autocorrelation coefficients from a distribution that induces a uniform distribution on the set of stationary AR(l) coefficients. These samples are then used as initial values, cf. also the discussion in Pötscher and Preinerstorfer (2016).

M1

A positive integer. Corresponds to M_1 in the description of (A2) in Pötscher and Preinerstorfer (2016). M1 must not exceed Mp.

M2

A positive integer. Corresponds to M_2 in the description of (A2) in Pötscher and Preinerstorfer (2016). M2 must not exceed M1.

Eicker

Determines the test for which the size is computed. If Eicker = TRUE, then the size of the test that rejects if T_{E, \mathsf{W}} is not smaller than C (with \mathsf{W}_{ij}=ker((i-j)/bandwidth)) is computed. If Eicker = FALSE, then the size of the test that rejects if T_{w} is not smaller than C (with w(j, n) = ker(j/bandwidth)) is computed (cf. Pötscher and Preinerstorfer (2016) for a precise definition of these test statistics). Default is Eicker = FALSE.

opt.method.1

The optimization method chosen in Stage 1 of (A2). Any optimization routine implemented in optim apart from "Brent" can be supplied. The default is "Nelder-Mead".

opt.method.2

The optimization method chosen in Stage 2 of (A2). Any optimization routine implemented in optim apart from "Brent" can be supplied. The default is "Nelder-Mead".

control.1

Control parameters passed to the optim function in Stage 1 of (A2). Default is control.1 = list("reltol" = N1^(-.5), "maxit" = dim(X)[1]*20).

control.2

Control parameters passed to the optim function in Stage 2 of (A2). Default is control.2 = list("reltol" = N2^(-.5), "maxit" = dim(X)[1]*30).

cores

The number of CPU cores used in the (parallelized) computation of the Monte-Carlo approximations in (A2). Default is 1. Parallelized computation is enabled only if the compiler used to build acrt supports OpenMP.

margin

The restrictions imposed on the partial autocorrelation coefficients. margin is an ar.order.max-dimensional vector of real numbers in (0, 1]. Default is margin = rep(1, length = ar.order.max), which corresponds to no restriction.

Details

For details see the relevant sections in Pötscher and Preinerstorfer (2016), in particular the description of Algorithm 2 in the Appendix.

Value

The output of size depends on ar.order.max. If ar.order.max is zero, the function size returns a list consisting of:

size

The size obtained by drawing a pseudorandom sample of size N2 from the distribution of the test statistic under the null hypothesis and by computing the fraction of observations giving rise to a test statistic not smaller than the critical value C.

If ar.order.max is greater than zero, the function size returns a list consisting of:

starting.parameters

The rows of this matrix are the initial values (partial autocorrelation coefficient vectors) that were used in Stage 1 of (A2), and which were chosen from the pool of randomly generated initial values in Stage 0. The rows correspond to ρ_{1:M_0}, ..., ρ_{M_1:M_0}, respectively, in the description of (A2).

starting.rejection.probs

Monte Carlo approximations of the null-rejection probabilities corresponding to the initial values used in Stage 1 of (A2). The coordinates of this vector correspond to \tilde{p}_{1:M_0}, ..., \tilde{p}_{M_1:M_0} in the description of (A2).

first.stage.parameters

The rows of this matrix are the parameters (partial autocorrelation coefficients) that were obtained in Stage 1 of (A2). The rows correspond to ρ^*_{1}, ..., ρ^*_{M_1}, respectively, in the description of (A2).

first.stage.rejection.probs

Monte Carlo approximations of the null-rejection probabilities corresponding to the first.stage.parameters, i.e., \bar{p}_{j, ρ_j^*} for j = 1, ..., M_1 in the description of (A2).

second.stage.parameters

The rows of this matrix are the parameters (partial autocorrelation coefficients) that were obtained in Stage 2 of (A2). The rows correspond to ρ^{**}_{1}, ..., ρ^{**}_{M_2}, respectively, in the description of (A2).

second.stage.rejection.probs

Monte Carlo approximations of the null rejection probabilities corresponding to the second.stage.parameters, i.e., \bar{\bar{p}}_{j, ρ_j^{**}} for j = 1, ..., M_2 in the description of (A2).

convergence

Convergence codes returned from optim in Stage 2 of (A2) for each initial value.

size

The size computed by (A2), i.e., the maximum of \bar{\bar{p}}_{j, ρ_j^{**}} for j = 1, ..., M_2.

References

Jones, M. C. (1987). Randomly choosing parameters from the stationarity and invertibility region of autoregressive-moving average models. Applied Statistics, 36 134-138

Pötscher, B.M. and Preinerstorfer, D. (2016). Controlling the size of autocorrelation robust tests. https://arxiv.org/abs/1612.06127/

See Also

optim, kweights.

Examples

## Not run: 
n <- 100
C <- 2.260568^2
ar.order.max <- n-1
bandwidth <- n/10
ker <- "Bartlett"
R <- matrix(c(0, 1), nrow = 1, ncol = 2)
X <- cbind(rep(1, length = n), rnorm(n))
N0 <- 1000
N1 <- 10000
N2 <- 50000
Mp <- 5000
M1 <- 10
M2 <- 2

size(C, ar.order.max, bandwidth, ker, R, X, N0, N1, N2, Mp, M1, M2)

## End(Not run)

[Package acrt version 1.0.1 Index]