qrr: Quantile Ratio Regression

View source: R/Qtools_qrr.R

qrrR Documentation

Quantile Ratio Regression

Description

This function fits a quantile ratio regression model

Usage

qrr(formula, data, taus, start = "rq", beta = NULL,
tsf = "bc", symm = TRUE, dbounded = FALSE, linearize = TRUE, 
kernel = "Gaussian", maxIter = 10, epsilon = 1e-05,
verbose = FALSE, method.rq = "fn", method.nlrq = "L-BFGS-B")

Arguments

formula

a formula object, with the response on the left of a ~ operator, and the terms, separated by + operators, on the right.

data

a data frame in which to interpret the variables named in the formula.

taus

a vector of two quantiles for the ratio to be estimated (the order is irrelevant).

start

the algorithm with which obtain the starting values for one of the quantiles in the ratio. Possible options are "rq" (linear regression model – see rq), "tsrq" (quantile regression transformation model – see tsrq), "conquer" (fast linear regression model – see conquer), "llqr" (nonparametric linear regression model – see llqr)

beta

starting values for the regression coefficients. If left NULL, these are set to 0.

tsf

if start = "tsrq", see tsrq.

symm

if start = "tsrq", see tsrq.

dbounded

if start = "tsrq", see tsrq.

linearize

logical flag. If TRUE (default), estimation is carried out with the linearized iterative algorithm of Farcomeni and Geraci (2023) by repeated calls to an appropriate linear estimation algorithm. Otherwise, the algorithm calls a nonlinear estimation routine. See argument method.rq and method.nlrq further below.

kernel

an optional vector of weights to be used in the fitting process. Should be NULL or a numeric vector.

maxIter

maximum number of iterations for fitting.

epsilon

tolerance for convergence.

verbose

logical flag. If TRUE, progress on estimation is print out.

method.rq

the method used to compute the linear fit. If linearize = TRUE, the options are "conquer" or any of those from rq (see the argument method).

method.nlrq

the method used to compute the nonlinear fit. If linearize = FALSE, the options are those from nlrq (see the argument method).

Details

These function implements quantile ratio regression as discussed by Farcomeni and Geraci (see references). The general model is assumed to be g(Q_{Y|X}(\tau_{1})/Q_{Y|X}(\tau_{2})) = \eta = Xb where Q denotes the conditional quantile function, Y is the response variable, X a design matrix, g is a monotone link function, and \tau_{1} and \tau_{2} the levels of the two quantiles in the ratio. In the current implementation, g(u) = log(u - 1), which ensures monotonocity (non-crossing) of the quantiles and leads to the familiar interpretation of the inverse logistic transformation.

Author(s)

Marco Geraci

References

Farcomeni A. and Geraci M. Quantile ratio regression. 2023. Working Paper.

See Also

coef.qrr, predict.qrr, summary.qrr, vcov.qrr

Examples


set.seed(123)
n <- 5000
x <- runif(n, -0.5, 0.5)
R <- 1 + exp(0.5 + 0.5*x)

# fit quintile ratio regression
alpha <- 1/log(R)*log(log(1-0.8)/log(1-0.2))
y <- rweibull(n, shape = alpha, scale = 1)
dd <- data.frame(x = x, y = y)
qrr(y ~ x, data = dd, taus = c(.2,.8))

# fit Palma ratio regression
alpha <- 1/log(R)*log(log(1-0.9)/log(1-0.4))
y <- rweibull(n, shape = alpha, scale = 1)
dd <- data.frame(x = x, y = y)
qrr(y ~ x, data = dd, taus = c(.4,.9))


Qtools documentation built on Nov. 2, 2023, 6:11 p.m.