predict.cv.hqreg: Model predictions based on "cv.hqreg" object.

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/predict.cv.hqreg.R

Description

This function makes predictions from a cross-validated hqreg model, using the stored fit and the optimal value chosen for lambda.

Usage

1
2
3
4
5
## S3 method for class 'cv.hqreg'
predict(object, X, lambda = c("lambda.1se","lambda.min"), 
    type = c("response","coefficients","nvars"), ...)
## S3 method for class 'cv.hqreg'
coef(object, lambda = c("lambda.1se","lambda.min"), ...)

Arguments

object

Fitted "hqreg" model object.

X

Matrix of values at which predictions are to be made. Used only for type = "response".

lambda

Values of the regularization parameter lambda at which predictions are requested. Default is the value "lambda.1se" stored on the CV object. Alternatively "lambda.min" can be used. If lambda is numeric, it is taken as the value(s) of lambda to be used.

type

Type of prediction. "response" returns the fitted values; "coefficients" returns the coefficients; "nvars" returns the number of nonzero coefficients at each value of lambda.

...

Not used. Other arguments to predict.

Value

The object returned depends on type.

Author(s)

Congrui Yi <congrui-yi@uiowa.edu>

References

Yi, C. and Huang, J. (2016) Semismooth Newton Coordinate Descent Algorithm for Elastic-Net Penalized Huber Loss Regression and Quantile Regression, https://arxiv.org/abs/1509.02957
Journal of Computational and Graphical Statistics, accepted in Nov 2016
http://www.tandfonline.com/doi/full/10.1080/10618600.2016.1256816

See Also

hqreg cv.hqreg

Examples

1
2
3
4
5
6
7
8
X = matrix(rnorm(1000*100), 1000, 100)
beta = rnorm(10)
eps = 4*rnorm(1000)
y = drop(X[,1:10] %*% beta + eps) 
cv = cv.hqreg(X, y, seed = 1011)
predict(cv, X[1:5,])
predict(cv, X[1:5,], lambda = "lambda.min")
predict(cv, X[1:5,], lambda = 0.05)


hqreg documentation built on May 19, 2017, 11:02 a.m.
Search within the hqreg package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.