test.stat {hrt} | R Documentation |
Computation of the test statistics
Description
This function computes the test statistics T_{uc}
, T_{Het}
(with HC0-HC4 weights), \tilde{T}_{uc}
, or \tilde{T}_{Het}
(with HC0R-HC4R weights) as defined in
Pötscher and Preinerstorfer (2021).
Usage
test.stat(y, R, r, X, hcmethod, restr.cov, tol = 1e-08, cores = 1)
Arguments
y |
Either an observation vector, or a matrix the columns of which are
observation vectors. The
number of rows of an observation vector must coincide with the number of rows
of the design matrix |
R |
The restriction matrix. |
r |
The restriction vector. |
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 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. |
tol |
(Small) positive real number. Tolerance parameter used in checking invertibility of the covariance matrix in the test statistic. Default is 1e-08. |
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. |
Details
For details concerning the test statistics please see the relevant sections in Pötscher and Preinerstorfer (2021) .
Value
The function returns a list consisting of:
test.val |
Either a vector the entries of which correspond to the values
of the
test statistic evaluated at each column of the input matrix |
References
Pötscher, B. M. and Preinerstorfer, D. (2021). Valid Heteroskedasticity Robust Testing. <arXiv:2104.12597>
Examples
n <- 20
y <- rnorm(n)
X <- cbind(rep(1, length = n), rnorm(n))
R <- matrix(1, nrow = 1, ncol = 2)
r <- 0
hcmethod <- 4
restr.cov <- FALSE
test.stat(y, R, r, X, hcmethod, restr.cov)