RPtest_single: Test significance of single predictors

Description Usage Arguments Value References See Also Examples

View source: R/RPtest_single.R

Description

Compute p-values for the significance of each variable in x.

Usage

1
RPtest_single(x, y, x_alt, B = 100L, rand_gen = rnorm, mc.cores = 1L)

Arguments

x

Input matrix with nobs rows, each an observation vector.

y

Response variable; shoud be a numeric vector.

x_alt

Optional: a matrix with jth column the sparse projection of the jth column of x on all its other columns i.e. the output of sparse_proj. If not supplied this is computed by the function.

B

Number of bootstrap samples. If set to 0, the asymptotic ditribution is used for calibration.

rand_gen

A function to generate the simulated errors up to an unknown scale factor. It must permit calling as rand_gen(nobs*B). Determines the form of errors in each of the null models, though the results are broadly insensitive to this choice. The default rnorm equates to null hypotheses of (sparse) Gaussian linear models. Setting rand_gen=NULL resamples residuals to generate simulated errors and approximates nulls of i.i.d. errors with unknown distributions.

mc.cores

Number of cores to use.

Value

A vector of p-values for each variable.

References

Shah, R. D., Buhlmann, P. (2017) Goodness of fit tests for high-dimensional linear models https://rss.onlinelibrary.wiley.com/doi/10.1111/rssb.12234

See Also

RPtest and sparse_proj

Examples

1
2
3
4
x <- scale(matrix(rnorm(50*100), 50, 100))
x <- scale(x)
y <- as.numeric(x[, 1:5] %*% rep(1, 5) + rnorm(nrow(x)))
out <- RPtest_single(x=x, y=y, B=25)

RPtests documentation built on July 11, 2021, 1:06 a.m.