crossvalidate.pim: Crossvalidate a glmnet PIM

Description Usage Arguments Value See Also Examples

Description

Crossvalidate a glmnet PIM

Usage

1
2
3
crossvalidate.pim(pimob, method = c("fullsplit", "semisplit", "naive"),
  type.measure = c("mse", "deviance", "class", "auc", "mae"), nfolds = 10,
  foldid, weights, ..., include.extrainfo = FALSE, verbosity = 0)

Arguments

pimob

Object of class pim. Note: it should really be of class glmnetpim in the current implementation.

method

"fullsplit" splits pseudo-observations over folds, "semisplit" takes the nonvalidating pseudo-observations together for the fit for each fold, "naive" simply crossvalidates over the pseudo-observations (note: typically, this is not correct!)

type.measure, nfolds, foldid, weights

See cv.glmnet

include.extrainfo

If TRUE (not the default), the return value contains two extra items, foldid and foldFits, that may be used to reassess the crossvalidation value

verbosity

The higher this value, the more levels of progress and debug information is displayed (note: in R for Windows, turn off buffered output)

...

Passed on to cv.glmnet (or .cvpo.glmnet).

Value

An object of class cv.pim, of class cv.glmnet, and depending on the type of linkfunction (see cv.glmnet) some more classes. It holds all the items of the original pimob and all necessary items for a cv.glmnet object (so the relevant S3 methods like print and plot will work for them.)

See Also

pim cv.glmnet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
set.seed(1)
pen.N<-100
pen.noisep<-50
pen.noisemat<-matrix(rnorm(pen.N*pen.noisep), nrow=pen.noisep)
pendta<-data.frame(y=rnorm(pen.N), x=factor(sample(2, pen.N, replace=TRUE)), pen.noisemat)
pendta$y[pendta$x=="2"]<-pendta$y[pendta$x=="2"]+1
colnames(pendta)[(1:pen.noisep)+2]<-paste("X", 1:pen.noisep, "X", sep="")
pen.formula<-paste("y~", paste(c("F(x)", setdiff(colnames(pendta), c("x", "y"))), collapse="+"), sep="")

penpim<-pim(as.formula(pen.formula), data=pendta, link="identity", poset=noselfposet, 
	estimator=estimator.glmnet(), varianceestimator=NULL, keep.data=TRUE, verbosity=0,
	interpretation="regular")
cv.penpim.naive<-crossvalidate.pim(penpim, method="naive")
cv.penpim<-crossvalidate.pim(penpim, method="fullsplit")
cv.penpim.ps<-crossvalidate.pim(penpim, method="semisplit")

pimold documentation built on May 2, 2019, 5:50 p.m.