midq2q | R Documentation |
This function recovers ordinary conditional quantile functions based on fitted mid-quantile regression models.
midq2q(object, newdata, observed = FALSE, ...)
object |
an object of |
newdata |
a required data frame in which to look for variables with which to predict. |
observed |
logical flag. If |
... |
not used. |
If the values of the support of the random variable are equally spaced integers, then observed
should ideally be set to FALSE
so that the ordinary quantile is obtained by rounding the predicted mid-quantile. Otherwise, the function returns an integer observed in the sample. See Geraci and Farcomeni for more details.
a vector or a matrix of estimated ordinary quantiles. The attribute Fhat
provides the corresponding estimated cumulative distribution.
Marco Geraci
Geraci, M. and A. Farcomeni. Mid-quantile regression for discrete responses. arXiv:1907.01945 [stat.ME]. URL: https://arxiv.org/abs/1907.01945.
plot.midq2q
, predict.midrq
## Not run:
# Esterase data
data(esterase)
# Fit quantiles 0.1, 0.15, ..., 0.85
fit <- midrq(Count ~ Esterase, tau = 2:17/20, data = esterase, type = 3, lambda = 0)
# Recover ordinary quantile function
xx <- seq(min(esterase$Esterase), max(esterase$Esterase), length = 5)
print(Qhat <- midq2q(fit, newdata = data.frame(Esterase = xx)))
# Plot
plot(Qhat, sub = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.