Learn R Programming

cosso (version 2.0-2)

cosso.qr: Fit a nonparaletric quantile regression model with COSSO regularization

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".
  • 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 weights can be specified based on either user's own discretion or adaptively computed from initial function estimates. See Storlie et al. (2011) for more discussions. One possible choice is to specify the weights as the inverse $L_2$ norm of initial function estimator, see KQRwt.

See Also

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

Examples

Run this code
data(ozone)
set.seed(27695)
## Use one third observations as training set
train_id   <- sample(1:nrow(ozone),round(nrow(ozone)/3))
cossoqrObj <- cosso.qr(x=ozone[train_id,-1],y=ozone[train_id,1],tau=0.5)
plot.cosso(cossoqrObj,plottype="Path")

## Adaptive COSSO-QR
adaptive.wt <- KQRwt(ozone[train_id,-1],ozone[train_id,1],0.5)
acossoqrObj <- cosso.qr(x=ozone[train_id,-1],y=ozone[train_id,1],tau=0.5,wt=adaptive.wt)

Run the code above in your browser using DataLab