mlikCV {multiridge} | R Documentation |
Outer-loop cross-validation for estimating performance of marginal likelihood based multiridge
Description
Outer-loop cross-validation for estimating performance of marginal likelihood based multiridge
.
Outer fold is for testing; penalty parameter tuning is performed by marginal likelihood estimation
Usage
mlikCV(penaltiesinit, XXblocks, Y, pairing = NULL, outfold = 5, nrepeatout = 1,
balance = TRUE,fixedfolds = TRUE, model = NULL, intercept =
ifelse(is(Y, "Surv"), FALSE, TRUE), reltol = 1e-04, trace = FALSE, optmethod1 = "SANN",
optmethod2 = ifelse(length(penaltiesinit) == 1, "Brent", "Nelder-Mead"),
maxItropt1 = 10, maxItropt2 = 25, parallel = FALSE, pref = NULL,
fixedpen = NULL, sigmasq = 1, opt.sigma=ifelse(model=="linear",TRUE, FALSE))
Arguments
penaltiesinit |
Numeric vector. Initial values for penaltyparameters. May be obtained from |
XXblocks |
List of |
Y |
Response vector: numeric, binary, factor or |
pairing |
Numerical vector of length 3 or |
outfold |
Integer. Outer fold for test samples. |
nrepeatout |
Integer. Number of repeated splits for outer fold. |
balance |
Boolean. Should the splits be balanced in terms of response labels? |
fixedfolds |
Boolean. Should fixed splits be used for reproducibility? |
intercept |
Boolean. Should an intercept be included? |
model |
Character. Any of |
trace |
Boolean. Should the output of the IWLS algorithm be traced? |
reltol |
Scalar. Relative tolerance for optimization methods. |
optmethod1 |
Character. First, global search method. Any of the methods |
optmethod2 |
Character. Second, local search method. Any of the methods |
maxItropt1 |
Integer. Maximum number of iterations for |
maxItropt2 |
Integer. Maximum number of iterations for |
parallel |
Boolean. Should computation be done in parallel? If |
pref |
Integer vector or |
fixedpen |
Integer vector or |
sigmasq |
Default error variance. |
opt.sigma |
Boolean. Should the error variance be optimized as well? Only relevant for |
Details
WARNING: this function may be very time-consuming. The number of evaluations may equal nrepeatout*outerfold*(maxItropt1+maxItropt2)
. Computing time may be estimated by multiplying computing time of optLambdas_mgcvWrap
by
nrepeatout*outerfold
.
Value
List with the following components:
sampleindex |
Numerical vector: sample indices |
true |
True responses |
linpred |
Cross-validated linear predictors |
See Also
optLambdas_mgcv
, optLambdas_mgcvWrap
which optimize the penalties.
Scoring
which may applied to output of this function to obtain overall cross-validated performance score.
doubleCV
for double cross-validation counterpart. A full demo and data are available from:
https://drive.google.com/open?id=1NUfeOtN8-KZ8A2HZzveG506nBwgW64e4
Examples
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
# Outer cross-validation, inner marginal likelihood optimization
## Not run:
perfmlik <- mlikCV(penaltiesinit=lambdas,XXblocks=XXmirmeth,Y=resp,outfold=10,
nrepeatout=1)
# Performance metrics
Scoring(perfmlik$linpred,perfmlik$true,score="auc",print=TRUE)
Scoring(perfmlik$linpred,perfmlik$true,score="brier",print=TRUE)
Scoring(perfmlik$linpred,perfmlik$true,score="loglik",print=TRUE)
## End(Not run)