GRPgrouptest: Test significance of groups or individual predictors in...

Description Usage Arguments Details Value References Examples

View source: R/GRPgrouptest.R

Description

The function can test significance of (potentially large) groups of predictors in low- and high-dimensional generalized linear models. Outputs a p-value.

Usage

1
2
GRPgrouptest(X, y, fam = c("gaussian", "binomial", "poisson"), G,
  B = 1000L, penalize = ifelse(p - length(G) >= n, TRUE, FALSE))

Arguments

X

Input matrix with n rows, each a p-dimensional observation vector.

y

Response vector.

fam

Must be "gaussian", "binomial" or "poisson".

G

A vector with indices of variables, whose significance we wish to ascertain, after controlling for variables in X. The size of G can be at most p-2.

B

The number of bootstrap samples to approximate the distribution of the test statistic. Note that the p-value returned will always be at least 1/(B+1).

penalize

If TRUE, penalization is used when fitting GLM models.

Details

The function can test the significance of a set of variables in a generalized linear model, whose indices are specified by G. penalize = TRUE is needed for high-dimensional settings where the number of variables not in G is larger than the number of observations. We then employ a penalized regression to regress y on to these variables implemented in cv.glmnet from package glmnet. For the low-dimensional case, an unpenalized regression may be used.

Value

The output is a single p-value.

References

Janková, J., Shah, R. D., Bühlmann, P. and Samworth, R. (2019) Goodness-of-fit testing in high-dimensional generalized linear models https://arxiv.org/abs/1908.03606

Examples

1
2
3
4
5
6
7
8
# Testing significance of a group of predictors in logistic regression

set.seed(1)
X <- matrix(rnorm(300*50), 300, 50)
z <- X[, 1:5] %*% rep(1, 5)
pr <- 1/(1 + exp(-z))
y <- rbinom(nrow(X), 1, pr)
(out <- GRPgrouptest(X, y, fam = "binomial", G = 5:10, B = 1000))

GRPtests documentation built on March 18, 2021, 9:06 a.m.