Learn R Programming

Clomial (version 1.8.0)

choose.best: Chooses the best trained Clomial model.

Description

Given the output of Clomial function, the likelihoods of all models are compared, and the best model is determined.

Usage

choose.best(models, U = NULL, PTrue = NULL, compareTo = NULL, upto = "All", doTalk=FALSE)

Arguments

models
The models trained by Clomial function.
U
The optional genotype matrix used for comparison.
PTrue
The optional clone frequency matrix used for comparison.
compareTo
The index of the model against which all other models are compared. Set to NULL to disable.
upto
The models with index less than this value are considered. Set to "All" to include every model.
doTalk
If TRUE, information on number of analyzed models is reported.

Value

A list will be made with the following entries:
err
A list with 2 entries; err$P and err$U the vectors of clonal frequency errors, and genotype errors, accordingly.
Li
A vector of the best obtained log-likelihood for each model.
bestInd
The index of the best model in terms of log-likelihood.
comparison
If compareTo is not NULL, the result of comparison with the corresponding model is reported.
bestModel
The best model in terms of log-likelihood.
seconds
A vector of the time taken, in seconds, to train each model.

Details

If compareTo, U, and PTrue are NULL no comparison will be done, and the function runs considerably faster.

References

Inferring clonal composition from multiple sections of a breast cancer, Zare et al., Submitted.

See Also

Clomial, Clomial.likelihood, Clomial.iterate

Examples

Run this code
set.seed(4)
data(breastCancer)
Dc <- breastCancer$Dc
Dt <- breastCancer$Dt
ClomialResult <-Clomial(Dc=Dc,Dt=Dt,maxIt=20,C=4,doParal=FALSE,binomTryNum=5)
chosen <- choose.best(models=ClomialResult$models)
M1 <- chosen$bestModel
print("Genotypes:")
round(M1$Mu)
print("Clone frequencies:")
M1$P
bestInd <- chosen$bestInd
plot(chosen$Li,ylab="Log-likelihood",type="l")
points(x=bestInd,y=chosen$Li[bestInd],col="red",pch=19)

Run the code above in your browser using DataLab