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<U+001B4CE3>her and Preinerstorfer (2021).
test.stat(y, R, r, X, hcmethod, restr.cov, tol = 1e-08, cores = 1)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 X.
The restriction matrix. test.stat computes a test
statistic for the hypothesis \(R \beta = r\). R needs to be of
full row rank, and needs to have the same number of columns as X.
The restriction vector. test.stat computes a test
statistic for the hypothesis \(R \beta = r\). r needs to be a
vector with the same number of coordinates as the number of rows of R.
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.
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
is TRUE the null-restricted versions of the covariance estimators are computed. Cf. P<U+001B4CE3>her
and Preinerstorfer (2021) and the references there for details.
TRUE or FALSE. Covariance matrix estimator based on null-restricted (TRUE) or unrestricted (FALSE) residuals.
(Small) positive real number. Tolerance parameter used in checking invertibility of the covariance matrix in the test statistic. Default is 1e-08.
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.
The function returns a list consisting of:
Either a vector the entries of which correspond to the values
of the
test statistic evaluated at each column of the input matrix y, or,
if y is a vector, the test statistic evaluated at y.
For details concerning the test statistics please see the relevant sections in P<U+001B4CE3>her and Preinerstorfer (2021) .
P<U+001B4CE3>her, B. M. and Preinerstorfer, D. (2021). Valid Heteroskedasticity Robust Testing. <arXiv:2104.12597>
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab