test.stat: Computation of the test statistics

Description Usage Arguments Details Value References Examples

View source: R/test.stat.R

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

1
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 X.

R

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

r

The restriction vector. test.stat computes a test statistic for the hypothesis R β = r. r needs to be a vector with the same number of coordinates as the number of rows of R.

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.

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 is TRUE the null-restricted versions of the covariance estimators are computed. Cf. Pötscher and Preinerstorfer (2021) and the references there for details.

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 y, or, if y is a vector, the test statistic evaluated at y.

References

Pötscher, B. M. and Preinerstorfer, D. (2021). Valid Heteroskedasticity Robust Testing. <arXiv:2104.12597>

Examples

1
2
3
4
5
6
7
8
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)

hrt documentation built on Sept. 8, 2021, 5:06 p.m.