Sequentially optimizes a marginal likelihood score w.r.t. ridge penalties for multiple data blocks.
optLambdas_mgcvWrap(penaltiesinit=NULL, XXblocks,Y, pairing=NULL, model=NULL, reltol=1e-4,
optmethod1= "SANN", optmethod2 =ifelse(length(penaltiesinit)==1,"Brent", "Nelder-Mead"),
maxItropt1=10,maxItropt2=25,tracescore=TRUE,fixedseed =TRUE, pref=NULL, fixedpen=NULL,
sigmasq = 1, opt.sigma=ifelse(model=="linear",TRUE, FALSE))
Numeric vector. Initial values for penaltyparameters. May be obtained from fastCV2
.
List of nxn
matrices. Usually output of createXXblocks
.
Response vector: numeric, binary, factor or survival
.
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.
Character. Any of c("linear", "logistic", "cox")
. Is inferred from
Y
when NULL
.
Scalar. Relative tolerance for optimization methods.
Character. First, global search method. Any of the methods c("Brent", "Nelder-Mead", "Sann")
may be used, but
simulated annealing by "Sann"
is recommended to search a wide landscape. Other unconstrained methods
offered by optim
may also be used, but have not been tested.
Character. Second, local search method. Any of the methods c("Brent", "Nelder-Mead", "Sann")
may be used, but
"Nelder-Mead"
is generally recommended. Other unconstrained methods
offered by optim
may also be used, but have not been tested.
Integer. Maximum number of iterations for optmethod1
.
Integer. Maximum number of iterations for optmethod2
.
Boolean. Should the output of the scores be traced?
Boolean. Should the initialization be fixed? For reproducibility.
Integer vector or NULL
. Contains indices of data types in XXblocks
that are preferential.
Integer vector or NULL
. Contains indices of data types of which penalty
is fixed to the corresponding value in penaltiesinit
.
Default error variance.
Boolean. Should the error variance be optimized as well? Only relevant for model="linear"
.
List, with components:
Outputs of all optimizers used
List of penalties found by the optimizers
Numerical vector with final, optimal penalties
As opposed to optLambdas_mgcv
this function first searches globally, then locally.
Hence, more time-consuming, but better guarded against multiple local optima.
See gam
for details on how the marginal likelihood is computed.
Wood, S. N. (2011), Fast stable restricted maximum likelihood and marginal likelihood estimation of semiparametric generalized linear models, J. Roy. Statist. Soc., B 73(1), 3-36.
optLambdas_mgcv
for one-pass optimization. A full demo and data are available from:
https://drive.google.com/open?id=1NUfeOtN8-KZ8A2HZzveG506nBwgW64e4