sqr {qfa} | R Documentation |
Spline Quantile Regression (SQR) by formula
Description
This function computes spline quantile regression (SQR) solution from response vector and design matrix.
It uses the FORTRAN code rqfnb.f
in the "quantreg" package with the kind permission of Dr. R. Koenker.
Usage
sqr(
formula,
tau = seq(0.1, 0.9, 0.2),
spar = NULL,
d = 1,
data,
subset,
na.action,
model = TRUE,
weighted = FALSE,
mthreads = TRUE,
method = c("AIC", "BIC"),
ztol = 1e-05
)
Arguments
formula |
a formula object, with the response on the left of a ~ operator, and the terms, separated by + operators, on the right. |
tau |
sequence of quantile levels in (0,1) |
spar |
smoothing parameter: if |
d |
subsampling rate of quantile levels (default = 1) |
data |
a data.frame in which to interpret the variables named in the formula |
subset |
an optional vector specifying a subset of observations to be used |
na.action |
a function to filter missing data (see |
model |
if |
weighted |
if |
mthreads |
if |
method |
a criterion for smoothing parameter selection if |
ztol |
a zero tolerance parameter used to determine the effective dimensionality of the fit |
Value
object of SQR fit
Examples
library(quantreg)
data(engel)
engel$income <- engel$income - mean(engel$income)
tau <- seq(0.1,0.9,0.05)
fit <- rq(foodexp ~ income,tau=tau,data=engel)
fit.sqr <- sqr(foodexp ~ income,tau=tau,spar=0.5,data=engel)
par(mfrow=c(1,1),pty="m",lab=c(10,10,2),mar=c(4,4,2,1)+0.1,las=1)
plot(tau,fit$coef[2,],xlab="Quantile Level",ylab="Coeff1")
lines(tau,fit.sqr$coef[2,])