size {hrt} | R Documentation |
Computing the Size of Heteroskedasticity Robust Tests
Description
This function provides an implementation of Algorithm 1 (if ) or 2 (if
), respectively, in Pötscher and Preinerstorfer
(2021). Which of the two algorithms is applied is automatically determined as a function of
.
The user is referred to the just-mentioned article for definitions, a detailed description of the problem solved the algorithms, and for a detailed description of the algorithms themselves.
Algorithm 1 is based on the function davies
from the package CompQuadForm. The parameters
lim
and acc
for davies
can be supplemented by the user.
Algorithms 1 and 2 are implemented using the function constrOptim
from stats in Stages 1 and 2; this function
is used with default parameters, but control parameters can be supplied by the user.
Usage
size(C, R, X, hcmethod, restr.cov, Mp, M1, M2,
N0 = NULL, N1 = NULL, N2 = NULL, tol = 1e-08,
control.1 = list("reltol" = 1e-02, "maxit" = dim(X)[1]*20),
control.2 = list("reltol" = 1e-03, "maxit" = dim(X)[1]*30),
cores = 1, lower = 0, eps.close = .0001, lim = 30000, acc = 0.001,
levelCl = 0, LBcheck = FALSE, as.tol = 1e-08)
Arguments
C |
Critical value. A positive real number (for negative critical values
the size of the test equals |
R |
The restriction matrix. |
X |
The design matrix |
hcmethod |
Integer in [-1, 4]. Determines the method applied in the construction of the covariance estimator
used in the test statistic. The value -1 corresponds to the unadjusted (i.e., classical) F statistic without df adjustment; the value 0
corresponds to the HC0 estimator; ...; the value 4 corresponds to the HC4 estimator. Note that in case |
restr.cov |
TRUE or FALSE. Covariance matrix estimator based on null-restricted (TRUE) or unrestricted (FALSE) residuals. |
Mp |
A positive integer (should be chosen large, e.g., 50000; but the feasibility depends on the dimension of
|
M1 |
A positive integer (should be chosen large, e.g., 500; but the feasibility depends on the dimension of |
M2 |
A positive integer. Corresponds to |
N0 |
Only used in case |
N1 |
Only used in case |
N2 |
Only used in case |
tol |
(Small) positive real number. Tolerance parameter used in checking invertibility of the covariance matrix in the test statistic. Default is 1e-08. |
control.1 |
Control parameters passed to the |
control.2 |
Control parameters passed to the |
cores |
The number of CPU cores used in the (parallelized) computations. Default is 1. Parallelized computation is enabled only if the compiler used to build hrt supports OpenMP. |
lower |
Number in |
eps.close |
(Small) positive real number. This determines the size of the dominant entry in the choice of the
initial values as discussed in the description of the input |
lim |
This input is needed in Algorithm 1. Only used in case |
acc |
This input is needed in Algorithm 1. Only used in case |
levelCl |
Number in |
LBcheck |
Either FALSE (default) or TRUE. If TRUE, then |
as.tol |
(Small) positive real number. Tolerance parameter used in checking rank
conditions for verifying Assumptions 1, 2, and for checking a non-constancy condition
on the test statistic in case |
Details
For details see the relevant sections in Pötscher and Preinerstorfer (2021), in particular the description of Algorithms 1 and 2 in the Appendix.
Value
The output of size
is the following:
starting.parameters |
The rows of this matrix are the initial values (diagonals of covariance matrices) that were used in Stage 1 of the algorithm, and which were chosen from the pool of initial values in Stage 0. |
starting.rejection.probs |
The null-rejection probabilities corresponding to the initial values used in Stage 1. |
first.stage.parameters |
The rows of this matrix are the parameters (diagonals of covariance matrices) that were obtained in Stage 1 of the algorithm. |
first.stage.rejection.probs |
The
null-rejection
probabilities corresponding to the |
second.stage.parameters |
The rows of this matrix are the parameters (diagonals of covariance matrices) that were obtained in Stage 2 of the algorithm. |
second.stage.rejection.probs |
The null-rejection probabilities
corresponding to the |
convergence |
Convergence codes returned from |
size |
The size computed by the algorithm, i.e., the maximum of the
|
References
Pötscher, B. M. and Preinerstorfer, D. (2021). Valid Heteroskedasticity Robust Testing. <arXiv:2104.12597>
See Also
Examples
#size of the classical (uncorrected) F-test in a location model
#with conventional t-critical value (5% level)
#it is known that (in this very special case) the conventional critical value
#is size-controlling (i.e., the resulting size should be 5% (approximately))
C <- qt(.975, df = 9)^2
R <- matrix(1, nrow = 1)
X <- matrix(rep(1, length = 10), nrow = 10, ncol = 1)
hcmethod <- -1
restr.cov <- FALSE
Mp <- 100
M1 <- 5
M2 <- 1
#here, the parameters are chosen such that the run-time is low
#to guarantee a high accuracy level in the computation,
#Mp, M1 and M2 should be chosen much higher
size(C, R, X, hcmethod, restr.cov, Mp, M1, M2)