Learn R Programming

quasar (version 0.1.0)

rankTest: Rank-score test for quantile regression

Description

Performs the rank-score test for the covariate of interest X, at the quantiles defined in tau, using a fitted quantile regression model. The test evaluates the null hypothesis that the coefficient of X is equal to zero against a two-sided alternative, at each specified quantile level. Testing equality to a non-zero value is not yet implemented.

Usage

rankTest(mod, X, tau = NULL, full = FALSE, h = NULL, alpha = 0.05)

Value

A data.frame containing:

  • Quantiles.Set: quantile levels

  • Statistic: rank-score test statistic

  • p.value: corresponding unadjusted \(p\)-value

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.

full

Logical. If TRUE, the function returns the test statistics and corresponding \(p\)-values for all intersection hypotheses containing tau. If FALSE (default), only the results for the single hypotheses are returned.

h

A numeric value for the bandwidth.

alpha

A numeric value used for bandwidth estimation. Following Koenker (2005), it is typically set equal to the desired significance level.

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

Koenker, R. (2005). Quantile Regression. Cambridge University Press.

See Also

rq, waldTest

Examples

Run this code
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)

# Rank test
rankTest(mod, X = "X")

Run the code above in your browser using DataLab