Learn R Programming

quasar (version 0.1.0)

waldTest: Wald-type test for quantile regression

Description

Performs the Wald-type 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 a given value beta against a two-sided alternative, at each specified quantile level.

Usage

waldTest(mod, X, tau = NULL, full = FALSE, h = NULL, beta = 0, alpha = 0.05)

Value

A data.frame containing:

  • Quantiles.Set: quantile levels

  • Statistic: Wald-type 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.

beta

Numeric value of the parameter of interest under the null hypothesis.

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, rankTest

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)

# Wald test
waldTest(mod, X = "X")

Run the code above in your browser using DataLab