Learn R Programming

BinaryReplicates (version 1.0.0)

cvEM: Cross-validation for the EM algorithm

Description

Cross-validation for the EM algorithm

Usage

cvEM(
  ni,
  si,
  ti = NULL,
  N_cv = NULL,
  N_init = 20,
  maxIter = 1000,
  errorMin = 1e-07,
  prior = list(a_FP = 2, b_FP = 2, a_FN = 2, b_FN = 2)
)

Value

A list with the following components:

models

A list of the models for each fold

predictions

A list of the predictions for each fold

Arguments

ni

Numeric vector of \(n_i\)'s, the total numbers of replicates for each individual

si

Numeric vector of \(s_i\)'s, the numbers of replicates equal to 1 for each individual

ti

Numeric vector of \(t_i\)'s, the true values of the binary variable for each individual. If NULL, the EM algorithm is used to estimate the parameters. Defaults to NULL. See details.

N_cv

The number of folds. Defaults to 20.

N_init

The number of initializations if ti is not provided. Defaults to 20.

maxIter

The maximum number of iterations if the EM algorithm is used. Defaults to 1e3.

errorMin

The minimum error for convergence if the EM algorithm is used. Defaults to 1e-7.

prior

A list of prior parameters for the model.

Details

This function chooses its algorithm according to what is provided in the ti argument:

ti is fully provided

The function computes the Maximum-A-Posteriori estimate, with an explicit formula.

ti is not provided

The function uses the EM algorithm to estimate the parameters.

ti is partially provided

The function uses the EM algorithm to estimate the parameters.

See Also

classify_with_scores, EMFit

Examples

Run this code
data("periodontal")
modelCV <- cvEM(periodontal$ni, periodontal$si)

Run the code above in your browser using DataLab