Learn R Programming

quasar (version 0.1.0)

closedTesting: Closed testing for quantile regression

Description

Applies the closed testing procedure to strongly control the familywise error rate (FWER) when testing the effect of a covariate of interest across multiple quantile regression models.

Usage

closedTesting(mod, X, tau = NULL, test = "rank-score", ...)

Value

An object of class quasar containing:

  • Quantile: quantile level

  • Coefficient: estimated coefficient

  • Statistic: test statistic

  • p.value: raw \(p\)-value

  • p.value.adjusted: adjusted \(p\)-value from the closed testing procedure

Arguments

mod

An object of class rqs returned by rq, representing the fitted quantile regression models.

X

A string indicating the covariate of interest.

tau

A numeric vector of quantiles of interest used in mod. If NULL (default), all quantiles from the mod object are considered.

test

Character. Type of test to be used. Options are "rank-score" and "wald".

...

Additional arguments, see rankTest, waldTest.

Author

Angela Andreella

Details

This procedure requires that the covariate of interest X is either numeric or, if categorical, has at most two levels. Multilevel categorical covariates are not supported and will trigger an error.

References

Marcus, R., Eric, P., & Gabriel, K. R. (1976). On closed testing procedures with special reference to ordered analysis of variance. Biometrika, 63(3), 655--660.

Goeman, J. J., Hemerik, J., & Solari, A. (2021). Only closed testing procedures are admissible for controlling false discovery proportions. The Annals of Statistics, 49(2), 1218--1238.

See Also

rq, rankTest, waldTest

Examples

Run this code
# Simulate data
set.seed(1234)
D <- simulateData(n = 100, gamma = 0.5, sigma.y = "1 + 2 * pmax(X, 0)")

# Quantile regressions at different levels
tau <- c(0.1, 0.25, 0.5, 0.75, 0.9)
mod <- quantreg::rq(y ~ X + Z1, tau = tau, data=D)

# Closed testing
res <- closedTesting(mod, X = "X")
res

# Summary and plot
summary(res, alpha = 0.1)
plot(res, alpha = 0.1, legend.position = "bottomright")

Run the code above in your browser using DataLab