quantreg (version 5.38)

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

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

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.

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

Run this code
# NOT RUN {
## 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))
# }

Run the code above in your browser using DataCamp Workspace