glmregNB(formula, data, weights, nlambda = 100, lambda=NULL, lambda.min.ratio =
ifelse(nobsmodel.frame.lambda values - default is 100.lambda sequencelambda, as a fraction of
lambda.max, the (data derived) entry value (i.e. the smallest
value for which all coefficients are zero). The default depends on the
sample size nobs relative to thalpha=1 is lasso (mcp, scad) penalty; and alpha=0 the ridge penalty.snet or mnet penalty.penalty="mnet" or penalty="snet" with family other than "gaussian". See referencestandardize=TRUE.
If variables are in the same units already, you might not wislambda to allow
differential shrinkage of coefficients. Can be 0 for some variables, which implies
no shrinkage, and that variable is always included in the
model. Default is same shrinkage for all1e-6.theta scaling parameterlambda value; default is 1000.eps in magnitude, then this number is considered as 0TRUE, fitting progress is reportedlink{glmreg} functionthetanlambda if theta.est=FALSE. Default is NULLpenalty="mnet" or "snet".logTRUE the corresponding components
of the fit (model frame, response, model matrix) are returned.levels from the
respective models"glmreg", "glmregNB" for the various types of models.length(lambda)nvars x
length(lambda) matrix of coefficients.lambda values usedlambda is fit by coordinate
descent. This is a lasso (mcp, scad) or elastic net (mnet, snet) regularization path
for fitting the negative binomial linear regression
paths, by maximizing the penalized log-likelihood.
Note that the objective function is
$$-\sum (weights * loglik) + \lambda*penalty$$ if standardize=FALSE and $$-\frac{weights}{\sum(weights)} * loglik + \lambda*penalty$$ if standardize=TRUE.Zhu Wang, Shuangge Ma, Michael Zappitelli, Chirag Parikh, Ching-Yun Wang and Prasad Devarajan (2014) Penalized Count Data Regression with Application to Hospital Stay after Pediatric Cardiac Surgery, Statistical Methods in Medical Research. 2014 Apr 17. [Epub ahead of print]
print, predict, coef and plot methods, and the cv.glmregNB function.data("bioChemists", package = "pscl")
fm_nb <- glmregNB(art ~ ., data = bioChemists)
coef(fm_nb)
### ridge regression
fm <- glmregNB(art ~ ., alpha=0, data = bioChemists, lambda=seq(0.001, 1, by=0.01))
fm <- cv.glmregNB(art ~ ., alpha=0, data = bioChemists, lambda=seq(0.001, 1, by=0.01))Run the code above in your browser using DataLab