rq.fit.sfnc | R Documentation |
Fit constrained regression quantiles using a sparse implementation of the Frisch-Newton Interior-point algorithm.
rq.fit.sfnc(x, y, R, r, tau = 0.5,
rhs = (1-tau)*c(t(x) %*% rep(1,length(y))),control)
x |
structure of the design matrix X stored in csr format |
y |
response vector |
R |
constraint matrix stored in csr format |
r |
right-hand-side of the constraint |
tau |
desired quantile |
rhs |
the right-hand-side of the dual problem; regular users shouldn't need to specify this. |
control |
control paramters for fitting see |
This is a sparse implementation of the Frisch-Newton algorithm for constrained quantile regression described in Koenker and Portnoy (1996). The sparse matrix linear algebra is implemented through the functions available in the R package SparseM.
coef |
Regression quantile coefficients |
ierr |
Error code for the internal Fortran routine
|
it |
Iteration count |
time |
Amount of time used in the computation |
Pin Ng
Koenker, R and Ng, P. (2002). SparseM: A Sparse Matrix Package for R; https://CRAN.R-project.org/package=SparseM
Koenker, R. and P. Ng(2005). Inequality Constrained Quantile Regression, Sankya, 418-440.
rq.fit.sfn
for the unconstrained version,
SparseM for the underlying sparse matrix R package.
## An artificial example :
n <- 200
p <- 50
set.seed(17)
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, ...)
R <- rbind(diag(p+1), -diag(p+1))
r <- c(rep( 0, p+1), rep(-1, p+1))
sX <- as.matrix.csr(X)
sR <- as.matrix.csr(R)
try(rq.o <- rq.fit.sfnc(sX, y, sR, r)) #-> not enough tmp memory
(tmpmax <- floor(1e5 + exp(-12.1)*(sX@ia[p+1]-1)^2.35))
## now ok:
rq.o <- rq.fit.sfnc(sX, y, sR, r, control = list(tmpmax = tmpmax))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.