Learn R Programming

cosso (version 2.1-0)

cosso.qr: Estimate the quantile function by Smoothing Splines with COSSO penalty

Description

Fit a penalized quantile regression model with COSSO regularization. The regularization path is computed for the COSSO penalty at a grid of values for the regularization parameter M.

Usage

cosso.qr(x,y,tau,wt=rep(1,ncol(x)),scale=FALSE,parallel=FALSE,cpus=1)

Arguments

x
input matrix; the number of rows is sample size, the number of columns is the data dimension. The range of input variables is scaled to [0,1].
y
response vector.
tau
the quantile to be estimated, a number strictly between 0 and 1.
wt
weights for predictors. Default is rep(1,ncol(x)).
scale
if TRUE, each predictor variable is rescaled to [0,1] interval. Dafault is FALSE.
parallel
parallelize task using snowfall package? Default is FALSE. Recommended when sample size is large.
cpus
number of available processor units. Default is 1.

Value

  • An object with S3 class "cosso".
  • familytype of regression model.
  • tauquantile to be estimated.
  • wtweights.
  • xinput matrix.
  • yresponse vector.
  • basis.idIndices of observations used to compute the kernel matrices. All observations will be used in quantile regression.
  • tunea list containing tuning result

Details

The quantile function is first assumed to have an additive form: $$\eta(x)=\sum_{j=1}^p\eta_j(x_j),$$ then estimated by minimizing the objective function: $$check~loss/nobs+\lambda_0\sum_{j=1}^p\theta^{-1}_jw_j^2||\eta_j||^2, s.t. \sum_{j=1}^p\theta_jKQRwt.

See Also

tune.cosso.qr, plot.cosso, predict.cosso

Examples

Run this code
data(ozone)
t0 <- proc.time()
set.seed(27695)
## Use one third observations for demonstration
train_id   <- sample(1:nrow(ozone),round(nrow(ozone)/3))
cossoqrObj <- cosso.qr(x=ozone[train_id,2:5],y=ozone[train_id,1],tau=0.5)
print((proc.time()-t0)[3])

data(ozone)
## Parallel Computing
t0 <- proc.time()
set.seed(27695)
train_id   <- sample(1:nrow(ozone),round(nrow(ozone)/3))
cossoqrObj <- cosso.qr(x=ozone[train_id,2:9],y=ozone[train_id,1],tau=0.5,parallel=TRUE,cpus=2)
print((proc.time()-t0)[3])

data(ozone)
set.seed(27695)
train_id   <- sample(1:nrow(ozone),round(nrow(ozone)/3))
## Adaptive COSSO-QR
adaptive.wt <- KQRwt(ozone[train_id,2:9],ozone[train_id,1],0.5)
acossoqrObj <- cosso.qr(x=ozone[train_id,2:9],y=ozone[train_id,1],tau=0.5,wt=adaptive.wt)

Run the code above in your browser using DataLab