coef.cv.HDtweedie | R Documentation |
This function gets coefficients or makes coefficient predictions from a cross-validated HDtweedie
model,
using the "cv.HDtweedie"
object, and the optimal value
chosen for lambda
.
## S3 method for class 'cv.HDtweedie' coef(object,s=c("lambda.1se","lambda.min"),...)
object |
fitted |
s |
value(s) of the penalty parameter |
... |
not used. Other arguments to predict. |
This function makes it easier to use the results of cross-validation to get coefficients or make coefficient predictions.
The coefficients at the requested values for lambda
.
Wei Qian, Yi Yang and Hui Zou
Maintainer: Wei Qian <weiqian@stat.umn.edu>
Qian, W., Yang, Y., Yang, Y. and Zou, H. (2016), “Tweedie's Compound
Poisson Model With Grouped Elastic Net,” Journal of Computational and Graphical Statistics, 25, 606-625.
Friedman, J., Hastie, T., and Tibshirani, R. (2010), "Regularization paths for generalized
linear models via coordinate descent," Journal of Statistical Software, 33, 1.
cv.HDtweedie
, and predict.cv.HDtweedie
methods.
# load HDtweedie library library(HDtweedie) # load data set data(auto) # 5-fold cross validation using the lasso cv0 <- cv.HDtweedie(x=auto$x,y=auto$y,p=1.5,nfolds=5) # the coefficients at lambda = lambda.1se coef(cv0) # define group index group1 <- c(rep(1,5),rep(2,7),rep(3,4),rep(4:14,each=3),15:21) # 5-fold cross validation using the grouped lasso cv1 <- cv.HDtweedie(x=auto$x,y=auto$y,group=group1,p=1.5,nfolds=5) # the coefficients at lambda = lambda.min coef(cv1, s = cv1$lambda.min)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.