Rq
rms Package Interface to quantreg Package
The Rq
function is the rms
front-end to the
quantreg
package's rq
function. print
and
latex
methods are also provided, and a fitting function
RqFit
is defined for use in bootstrapping, etc. Its result is a
function definition.
For the print
method, format of output is controlled by the
user previously running options(prType="lang")
where
lang
is "plain"
(the default), "latex"
, or
"html"
. For the latex
method, html
will actually
be used of options(prType='html')
.
- Keywords
- models, nonparametric
Usage
Rq(formula, tau = 0.5, data, subset, weights, na.action=na.delete,
method = "br", model = FALSE, contrasts = NULL,
se = "nid", hs = TRUE, x = FALSE, y = FALSE, ...)# S3 method for Rq
print(x, digits=4, coefs=TRUE, title, …)
# S3 method for Rq
latex(object,
file = paste(first.word(deparse(substitute(object))),
".tex", sep = ""), append=FALSE,
which, varnames, columns=65, inline=FALSE, caption=NULL, ...)
# S3 method for Rq
predict(object, …, kint=1, se.fit=FALSE)
RqFit(fit, wallow=TRUE, passdots=FALSE)
Arguments
- formula
model formula
- tau
the single quantile to estimate. Unlike
rq
you cannot estimate more than one quantile at one model fitting.- data,subset,weights,na.action,method,model,contrasts,se,hs
see
rq
- x
set to
TRUE
to store the design matrix with the fit. Forprint
is anRq
object.- y
set to
TRUE
to store the response vector with the fit- …
other arguments passed to one of the
rq
fitting routines. Forlatex.Rq
these are optional arguments passed tolatexrms
. Ignored forprint.Rq
. Forpredict.Rq
this is usually just anewdata
argument.- digits
number of significant digits used in formatting results in
print.Rq
.- coefs
specify
coefs=FALSE
to suppress printing the table of model coefficients, standard errors, etc. Specifycoefs=n
to print only the firstn
regression coefficients in the model.- title
a character string title to be passed to
prModFit
- object
an object created by
Rq
- file,append,which,varnames,columns,inline,caption
see
latexrms
- kint
ignored
- se.fit
set to
TRUE
to obtain standard errors of predicted quantiles- fit
an object created by
Rq
- wallow
set to
TRUE
ifweights
are allowed in the current context.- passdots
set to
TRUE
if … may be passed to the fitter
Value
Rq
returns a list of class "rms", "lassorq"
or "scadrq",
"Rq"
, and "rq"
. RqFit
returns a function
definition. latex.Rq
returns an object of class "latex"
.
Note
The author and developer of methodology in the quantreg
package
is Roger Koenker.
See Also
Examples
# NOT RUN {
set.seed(1)
n <- 100
x1 <- rnorm(n)
y <- exp(x1 + rnorm(n)/4)
dd <- datadist(x1); options(datadist='dd')
fq2 <- Rq(y ~ pol(x1,2))
anova(fq2)
fq3 <- Rq(y ~ pol(x1,2), tau=.75)
anova(fq3)
pq2 <- Predict(fq2, x1)
pq3 <- Predict(fq3, x1)
p <- rbind(Median=pq2, Q3=pq3)
plot(p, ~ x1 | .set.)
# For superpositioning, with true curves superimposed
a <- function(x, y, ...) {
x <- unique(x)
col <- trellis.par.get('superpose.line')$col
llines(x, exp(x), col=col[1], lty=2)
llines(x, exp(x + qnorm(.75)/4), col=col[2], lty=2)
}
plot(p, addpanel=a)
# }