Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/cv.glmregNegbin.R
Does kfold crossvalidation for glmregNB, produces a plot,
and returns crossvalidated loglikelihood values for lambda
1 2 
formula 
symbolic description of the model 
data 
arguments controlling formula processing
via 
weights 
Observation weights; defaults to 1 per observation 
lambda 
Optional usersupplied lambda sequence; default is

nfolds 
number of folds  default is 10. Although 
foldid 
an optional vector of values between 1 and 
plot.it 
a logical value, to plot the estimated loglikelihood values if 
se 
a logical value, to plot with standard errors. 
n.cores 
The number of CPU cores to use. The crossvalidation loop will attempt to send different CV folds off to different cores. 
... 
Other arguments that can be passed to 
The function runs glmregNB
nfolds
+1 times; the
first to get the lambda
sequence, and then the remainder to
compute the fit with each of the folds omitted. The error is
accumulated, and the average error and standard deviation over the
folds is computed.
Note that cv.glmregNB
does NOT search for
values for alpha
. A specific value should be supplied, else
alpha=1
is assumed by default. If users would like to
crossvalidate alpha
as well, they should call cv.glmregNB
with a precomputed vector foldid
, and then use this same fold vector
in separate calls to cv.glmregNB
with different values of
alpha
.
an object of class "cv.glmregNB"
is returned, which is a
list with the ingredients of the crossvalidation fit.
fit 
a fitted glmregNB object for the full data. 
residmat 
matrix of loglikelihood values with row values for 
cv 
The mean crossvalidated loglikelihood values  a vector of length

cv.error 
The standard error of crossvalidated loglikelihood values  a vector of length

fraction 
a vector of 
foldid 
indicators of data used in each crossvalidation, for reproductive purposes 
lambda.which 
index of 
lambda.optim 
value of 
Zhu Wang <zwang@connecticutchildrens.org>
Zhu Wang, Shuangge Ma, Michael Zappitelli, Chirag Parikh, ChingYun 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]
glmregNB
and plot
, predict
, and coef
methods for "cv.glmregNB"
object.
1 2 3 4 5 6  ## Not run:
data("bioChemists", package = "pscl")
fm_nb < cv.glmregNB(art ~ ., data = bioChemists)
plot(fm_nb)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.