Description Usage Arguments Details Value Author(s) References Examples
This function is used to fit a quantile regression model when the response is a count variable.
1 2 3 4 |
formula |
an object of class |
tau |
quantile to be estimated. |
data |
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lqm is called. |
tsf |
transformation to be used. Possible options are |
symm |
logical flag. If |
lambda |
a numerical value for the transformation parameter. This is provided by the user or set to zero if not specified. |
weights |
an optional vector of weights to be used in the fitting process. |
offset |
an optional offset to be included in the model frame. |
contrasts |
an optional list. See the |
M |
number of dithered samples. |
zeta |
small constant (see References). |
B |
right boundary for uniform random noise U[0,B] to be added to the response variable (see References). |
cn |
small constant to be passed to |
alpha |
significance level. |
method |
estimation method for the fitting process. See |
A linear quantile regression model is fitted to the log–transformed response. Additional tranformation functions will be implemented. The notation used here follows closely that of Machado and Santos Silva (2005). This function is based on routines from package quantreg
(Koenker, 2013). See also lqm.counts
from package lqmm
(Geraci, 2014) for Laplace gradient estimation.
a list of class rq.counts
containing the following components
call |
the matched call. |
method |
the fitting algorithm for |
x |
the model matrix. |
y |
the model response. |
tau |
the order of the estimated quantile(s). |
tsf |
tranformation used (see also |
coefficients |
regression quantile (on the log–scale). |
fitted.values |
fitted values (on the response scale). |
tTable |
coefficients, standard errors, etc. |
offset |
offset. |
M |
specified number of dithered samples for standard error estimation. |
Mn |
actual number of dithered samples used for standard error estimation that gave an invertible D matrix (Machado and Santos Silva, 2005). |
InitialPar |
starting values for coefficients. |
terms |
the terms object used. |
term.labels |
names of coefficients. |
rdf |
the number of residual degrees of freedom. |
Marco Geraci
Geraci M and Jones MC. Improved transformation-based quantile regression. Canadian Journal of Statistics 2015;43(1):118-132.
Koenker R (2013). quantreg: Quantile Regression. R package version 5.05. URL http://CRAN.R-project.org/package=quantreg.
Machado JAF and Santos Silva JMC (2005). Quantiles for counts. Journal of the American Statistical Association, 100(472), 1226–1237.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Esterase data
data(esterase)
# Fit quantiles 0.25 and 0.75
fit1 <- rq.counts(Count ~ Esterase, tau = 0.25, data = esterase, M = 50)
coef(fit1)
fit2 <- rq.counts(Count ~ Esterase, tau = 0.75, data = esterase, M = 50)
coef(fit2)
# Plot
with(esterase, plot(Count ~ Esterase))
lines(esterase$Esterase, fit1$fitted.values, col = "blue")
lines(esterase$Esterase, fit2$fitted.values, col = "red")
legend(8, 1000, lty = c(1,1), col = c("blue", "red"), legend = c("tau = 0.25","tau = 0.75"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.