crossValidate: Crossvalidate a model

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

View source: R/crossValidate.R

Description

Crossvalidate a model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  crossValidate(model, ..., verbosity = 0)

  ## S3 method for class 'EMLassoGLoMo'
crossValidate(model,
    ds=model$result[[1]]$ds, out=model$result[[1]]$out,
    wts=rep(1, nrow(ds)),
    imputeDs2FitDsProperties=model$imputeDs2FitDsProperties,
    imputations=10, ..., type.measure="auc",
    keepResultPerLambda=FALSE, nobs=1, unpenalized=FALSE,
    verbosity=0)

  repeatedlyPredictOut(glomo, ds, out, varsets, reps = 10,
    nfolds = 10,
    imputeDs2FitDsProperties = normalImputationConversion(),
    returnGroups = FALSE, returnCoefs = FALSE, ...,
    reusabledata, noScaling = TRUE, verbosity = 0)

  repeatedPredictedProbAUC(reppredprob, out, verbosity = 0,
    groups, onlyresult = TRUE, glmnetlike = TRUE)

  cv.MI.logreg(glomo, ds, out, useVarNames, reps,
    imputeDs2FitDsProperties = normalImputationConversion(),
    lambda, useAsGlmnetFit, ..., verbosity = 0)

Arguments

model

model fit

...

for flexibility in 'derived' implementation (passed on to collectImputationModels in crossValidate.EMLassoGLoMo)

verbosity

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

ds

dataset with predictors

out

vector (binary factor) of outcomes

wts

vector of weights (defaults to equal weights for all rows)

imputeDs2FitDsProperties

see imputeDs2FitDs object that will provide the conversion from imputed dataset to one that is ready for fitting the predictor model

imputations

Number of multiple imputations on the complete dataset (defaults to 10)

type.measure

see cv.glmnet

keepResultPerLambda

if TRUE (not the default), the individual results from the crossValidate.EMLasso1l are also returned in an extra item resultPerLambda

nobs

how many observations are simulated for each row with missing data

unpenalized

if TRUE (not the default) a simple regression model is fit with the selected variables

glomo

GLoMo model to predict from

varsets

list of character vectors holding the variables (names) to be checked

reps

number of predictions

nfolds

number of folds for crossvalidation

returnGroups

if TRUE, a list is returned with the normal result as its result item and a matrix holding the group assignment per repetition as the groups item.

returnCoefs

if TRUE, a list is returned with the normal result as its result item and a list of matrices holding the coefficient values per repetition and per fold as the coefs item.

reusabledata

optional premade result of reusableDataForGLoMoSampling

noScaling

if TRUE (the default) the data is not scaled upon conversion

reppredprob

one of the matrices as return by repeatedlyPredictOut

groups

vector/matrix of fold membership assignment. If nor present, 10 random groups are created

onlyresult

if FALSE, the return value holds (as list members) the the overall AUC and sd, but also the results per repetition

glmnetlike

if TRUE, calcAUC.glmnet is used to calculate AUC and sd, otherwise calcAUC.Binary is used

useVarNames

names of columns to include in the model (character vector)

lambda

value to use as lambda in the return value (note: ignored for the rest)

useAsGlmnetFit

object that can be used for the glmnet.fit item in the return value

Value

object that has as class: "cv." pasted before the class of model. Normally, model will will be the return value of EMLasso, so this result is mainly the same as a cv.glmnet. The added/altered items are:

glmnet.fit

is now the model passed in, so has more classes besides "glmnet" (e.g. "EMLasso")

resultPerLambda

matrix with one column per imputation. The top rows are the estimates for the criterion per lambda, below that are their SD estimates. Not present if keepResultPerLambda=FALSE

List of the same length as varsets (unless it was length 1, then the first object is simply returned). Each item is a matrix with one row for each row in ds and one column per reps, and holds the predicted probability in a crossvalidation.

named vector of length 2, holding the "AUC" and the "AUCSD"

object of classes "cv.MI.logreg", "cv.glmnet" and "cv.lognet". Has exactly the items of a cv.glmnet object

Note

aids to generalize crossvalidation

Author(s)

Nick Sabbe nick.sabbe@ugent.be

See Also

EMLasso, cv.glmnet

Examples

1
2
3
4
5
6
7
y<-rbinom(nrow(iris), 1, 0.5)
iris.cpy<-randomNA(iris, n=0.1)
iris.emlognet<-EMLasso(ds=numdfr(iris.cpy), out=y,
	lambdas=c(0.03,0.002,0.0003), nrOfSamplesPerMDRow=7, verbosity=2,
	convergenceChecker=convergenceCheckCreator(minIt=5, maxIt=10))
sfStop()
iris.cv.emlognet<-crossValidate(iris.emlognet, verbosity=2)

EMLasso documentation built on May 2, 2019, 5:49 p.m.