CVscore: Cross-validated score

Description Usage Arguments Details Value See Also Examples

View source: R/MultiLambdaCVfun.R

Description

Cross-validated score for given penalty parameters.

Usage

1
2
3
4
CVscore(penalties, XXblocks, Y, X1 = NULL, pairing = NULL, folds, intercept =
ifelse(class(Y) == "Surv",FALSE, TRUE), frac1 = NULL, score = "loglik", model =
NULL, eps = 1e-07, maxItr = 100, trace = FALSE,   printCV = TRUE, save = FALSE,
parallel = FALSE)

Arguments

penalties

Numeric vector.

XXblocks

List of nxn matrices. Usually output of createXXblocks.

Y

Response vector: numeric, binary, factor or survival.

X1

Matrix. Dimension n x p_0, p_0 < n, representing unpenalized covariates

pairing

Numerical vector of length 3 or NULL when pairs are absent. Represents the indices (in XXblocks) of the two data blocks involved in pairing, plus the index of the paired block.

folds

List of integer vector. Usually output of CVfolds.

intercept

Boolean. Should an intercept be included?

frac1

Scalar. Prior fraction of cases. Only relevant for model=" logistic".

score

Character. See Details.

model

Character. Any of c("linear", "logistic", "cox"). Is inferred from Y when NULL.

eps

Scalar. Numerical bound for IWLS convergence.

maxItr

Integer. Maximum number of iterations used in IWLS.

trace

Boolean. Should the output of the IWLS algorithm be traced?

printCV

Boolean. Should the CV-score be printed on screen?

save

Boolean. If TRUE appends the penalties and resulting CVscore to global variable allscores

parallel

Boolean. Should computation be done in parallel? If TRUE, requires to run setupParallel first.

Details

See Scoring for details on score.

Value

Numeric, cross-validated prediction score for given penalties

See Also

doubleCV for double cross-validation, used for performance evaluation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(dataXXmirmeth)
resp <- dataXXmirmeth[[1]]
XXmirmeth <- dataXXmirmeth[[2]]

# Find initial lambdas: fast CV per data block separately.
cvperblock2 <- fastCV2(XXblocks=XXmirmeth,Y=resp,kfold=10,fixedfolds = TRUE)
lambdas <- cvperblock2$lambdas

# Create training-test splits
leftout <- CVfolds(Y=resp,kfold=10,nrepeat=3,fixedfolds = TRUE)
CVscore(penalties=lambdas, XXblocks=XXmirmeth,Y=resp,folds=leftout,score="loglik")

multiridge documentation built on June 15, 2021, 9:08 a.m.