rqss {nprq} | R Documentation |
Fitting function for additive quantile regression models with possible univariate and/or bivariate nonparametric terms estimated by total variation regularization.
rqss(formula, tau = 0.5, data = parent.frame(), weights, na.action, method = "fn", contrasts = NULL, ...)
formula |
a formula object, with the response on the left of a `~'
operator, and terms, separated by `+' operators, on the right.
The terms may include qss terms that represent additive
nonparametric components. These terms can be univariate or
bivariate. See qss for details on how to
specify these terms. |
tau |
the quantile to be estimated, this must be a number between 0 and 1, |
data |
a data.frame in which to interpret the variables named in the formula, or in the subset and the weights argument. |
weights |
vector of observation weights; if supplied, the algorithm fits to minimize the sum of the weights multiplied into the absolute residuals. The length of weights must be the same as the number of observations. The weights must be nonnegative and it is strongly recommended that they be strictly positive, since zero weights are ambiguous. |
na.action |
a function to filter missing data.
This is applied to the model.frame after any subset argument has been used.
The default (with na.fail ) is to create an error if any missing values are
found. A possible alternative is na.omit , which
deletes observations that contain one or more missing values.
|
method |
the algorithmic method used to compute the fit. There are currently
two options. Both are implementations of the FrischNewton interior
point method described in detail in Portnoy and Koenker(1997). Both
are implemented using sparse Cholesky decomposition as described in
Koenker and Ng (2003)
Option "sfnc" is used if the user specifies inequality constraints.
Option "sfn" is used if there are no inequality constraints.
Linear inequality constraints on the fitted coefficients are specified
by a matrix R and a vector r , specified inside the qss
terms, representing the constraints in the form $Rb >=q r$. |
contrasts |
a list giving contrasts for some or all of the factors
default = NULL appearing in the model formula.
The elements of the list should have the same name as the variable
and should be either a contrast matrix (specifically, any full-rank
matrix with as many rows as there are levels in the factor),
or else a function to compute such a matrix given the number of levels.
|
... |
additional arguments for the fitting routines
(see rq.fit.sfn and rq.fit.sfnc
and the functions they call). |
Total variation regularization for univariate and bivariate nonparametric quantile smoothing is described in Koenker, Ng and Portnoy (1994) and Koenker and Mizera(2003) respectively. The additive model extension of this approach depends crucially on the sparse linear algebra implementation for R described in Koenker and Ng (2003).
The function returns a fitted object representing the estimated
model specified in the formula. See rqss.object
for further details on this object, and references to methods
to look at it.
Roger Koenker
[1] Koenker, R. and S. Portnoy (1997) The Gaussian Hare and the Laplacean Tortoise: Computability of Squared-error vs Absolute Error Estimators, (with discussion). Statistical Science, 12, 279-300.
[2] Koenker, R., P. Ng and S. Portnoy, (1994) Quantile Smoothing Splines'' Biometrika, 81, 673-680.
[3] Koenker, R. and I. Mizera, (2003) Penalized Triograms: Total Variation Regularization for Bivariate Smoothing, JRSS(B), forthcoming.
[4] Koenker, R. and P. Ng (2003) SparseM: A Sparse Linear Algebra Package for R, J. Stat. Software.
n <- 200 x <- sort(rchisq(n,4)) z <- x + rnorm(n) y <- log(x)+ .1*(log(x))^2 + log(x)*rnorm(n)/4 + z plot(x,y-z) fit <- rqss(y~qss(x,constraint="N")+z) lines(x[-1],fit$coef[1]+fit$coef[-(1:2)]) fit <- rqss(y~qss(x,constraint="I")+z) lines(x[-1],fit$coef[1]+fit$coef[-(1:2)],col="blue") fit <- rqss(y~qss(x,constraint="CI")+z) lines(x[-1],fit$coef[1]+fit$coef[-(1:2)],col="red") #Cleanup rm(list=ls()) #A bivariate example data(CobarOre) attach(CobarOre) fit <- rqss(z~qss(cbind(x,y),lambda=.08)) plot(fit)