Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rq.fit.sfn

Sparse Regression Quantile Fitting


Description

Fit a quantile regression model using a sparse implementation of the Frisch-Newton interior-point algorithm.

Usage

rq.fit.sfn(a, y, tau = 0.5, rhs = (1-tau)*c(t(a) %*% rep(1,length(y))), control)

Arguments

a

structure of the design matrix X stored in csr format

y

response vector

tau

desired quantile

rhs

the right-hand-side of the dual problem; regular users shouldn't need to specify this, but in special cases can be quite usefully altered to meet special needs. See e.g. Section 6.8 of Koenker (2005).

control

control parameters for fitting routines: see sfn.control

Details

This is a sparse implementation of the Frisch-Newton algorithm for quantile regression described in Portnoy and Koenker (1997). The sparse matrix linear algebra is implemented through the functions available in the R package SparseM.

Value

coef

Regression quantile coefficients

ierr

Error code for the internal Fortran routine srqfnc:

1:

insufficient work space in call to extract

2:

nnzd > nnzdmax

3:

insufficient storage in iwork when calling ordmmd

4:

insufficient storage in iwork when calling sfinit

5:

nnzl > nnzlmax when calling sfinit

6:

nsub > nsubmax when calling sfinit

7:

insufficient work space in iwork when calling symfct

8:

inconsistancy in input when calling symfct

9:

tmpsiz > tmpmax when calling bfinit; increase tmpmax

10:

nonpositive diagonal encountered, not positive definite

11:

insufficient work storage in tmpvec when calling blkfct

12:

insufficient work storage in iwork when calling blkfct

17:

tiny diagonals replaced with Inf when calling blkfct

it

Iteration count

time

Amount of time used in the computation

Author(s)

Pin Ng

References

Portnoy, S. and R. Koenker (1997) The Gaussian Hare and the Laplacean Tortoise: Computability of Squared-error vs Absolute Error Estimators, (with discussion). Statistical Science, 12, 279-300.

Koenker, R and Ng, P. (2003). SparseM: A Sparse Matrix Package for R, J. of Stat. Software, 8, 1–9.

Koenker, R. (2005) Quantile Regression, Cambridge U. Press.

See Also

rq.fit.sfnc for the constrained version, SparseM for a sparse matrix package for R

Examples

## An artificial example :
n <- 200
p <- 50
set.seed(101)
X <- rnorm(n*p)
X[abs(X) < 2.0] <- 0
X <- cbind(1, matrix(X, n, p))
y <- 0.5 * apply(X,1,sum) + rnorm(n) ## true beta = (0.5, 0.5, ...)

sX <- as.matrix.csr(X)
try(rq.o <- rq.fit.sfn(sX, y)) #-> not enough tmp memory
(tmpmax <- floor(1e5 + exp(-12.1)*(sX@ia[p+1]-1)^2.35))
## now ok:
rq.o <- rq.fit.sfn(sX, y, control = list(tmpmax= tmpmax))

quantreg

Quantile Regression

v5.85
GPL (>= 2)
Authors
Roger Koenker [cre, aut], Stephen Portnoy [ctb] (Contributions to Censored QR code), Pin Tian Ng [ctb] (Contributions to Sparse QR code), Blaise Melly [ctb] (Contributions to preprocessing code), Achim Zeileis [ctb] (Contributions to dynrq code essentially identical to his dynlm code), Philip Grosjean [ctb] (Contributions to nlrq code), Cleve Moler [ctb] (author of several linpack routines), Yousef Saad [ctb] (author of sparskit2), Victor Chernozhukov [ctb] (contributions to extreme value inference code), Ivan Fernandez-Val [ctb] (contributions to extreme value inference code), Brian D Ripley [trl, ctb] (Initial (2001) R port from S (to my everlasting shame -- how could I have been so slow to adopt R!) and for numerous other suggestions and useful advice)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.