Description Usage Arguments Details Value See Also Examples

View source: R/MultiLambdaCVfun.R

Optimizes a marginal likelihood score w.r.t. ridge penalties for multiple data blocks.

1 2 3 4 |

`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 |

`model` |
Character. Any of |

`reltol` |
Scalar. Relative tolerance for optimization methods. |

`optmethod` |
Character. Optimization method. Any of the methods |

`maxItropt` |
Integer. Maximum number of iterations for |

`tracescore` |
Boolean. Should the output of the scores be traced? |

`fixedpen` |
Integer vector or |

`fixedseed` |
Boolean. Should the initialization be fixed? For reproducibility. |

`sigmasq` |
Default error variance. |

`opt.sigma` |
Boolean. Should the error variance be optimized as well? Only relevant for |

See `gam`

for details on how the marginal likelihood is computed.

List, with components:

`optres` |
Output of the optimizer |

`optpen` |
Vector with determined optimal penalties |

`allsc` |
Matrix with marginal likelihood scores for all penalty parameter configurations used by the optimizer |

`optLambdas_mgcvWrap`

for i) (recommended) optimization in two steps: first global, then local; and ii) sequential optimization
when some data types are preferred over others. A full demo and data are available from:

https://drive.google.com/open?id=1NUfeOtN8-KZ8A2HZzveG506nBwgW64e4

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
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 (repeated) CV-splits of the data.
leftout <- CVfolds(Y=resp,kfold=10,nrepeat=3,fixedfolds = TRUE)
# Compute cross-validated score for initial lambdas
CVscore(penalties=lambdas, XXblocks=XXmirmeth,Y=resp,folds=leftout,
score="loglik")
# Optimize by using marginal likelihood criterion
jointlambdas2 <- optLambdas_mgcvWrap(penaltiesinit=lambdas, XXblocks=XXmirmeth,
Y=resp)
# Optimal lambdas
optlambdas <- jointlambdas2$optpen
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.