qrr | R Documentation |
This function fits a quantile ratio regression model
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")
formula |
a formula object, with the response on the left of a |
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 |
beta |
starting values for the regression coefficients. If left |
tsf |
if |
symm |
if |
dbounded |
if |
linearize |
logical flag. If |
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 |
method.rq |
the method used to compute the linear fit. If |
method.nlrq |
the method used to compute the nonlinear fit. If |
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.
Marco Geraci
Farcomeni A. and Geraci M. Quantile ratio regression. 2023. Working Paper.
coef.qrr
, predict.qrr
, summary.qrr
, vcov.qrr
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.