| cross.entropy {LEA} | R Documentation |
Return the cross-entropy criterion for runs of snmfcwith K ancestral populations.
The cross-entropy criterion is based on the prediction of masked genotypes to evaluate the fit of a model with K populations. The cross-entropy criterion helps choosing the number of ancestral populations or a best run for a fixed value of K. A smaller value of cross-entropy
means a better run in terms of prediction capability.
The cross-entropy criterion is computed by the snmf function when the entropy Boolean option is TRUE.
cross.entropy(object, K, run)
object |
A snmfProject object. |
K |
The number of ancestral populations. |
run |
A vector of run labels. |
res |
A matrix containing the cross-entropy criterion for runs with K ancestral populations. |
Eric Frichot
### Example of analyses using snmf ###
# creation of a genotype file: genotypes.geno.
# The data contains 400 SNPs for 50 individuals.
data("tutorial")
write.geno(tutorial.R, "genotypes.geno")
################
# running snmf #
################
# Runs with K = 3 populations
# cross-entropy is computed for 2 runs.
project = NULL
project = snmf("genotypes.geno",
K = 3,
entropy = TRUE,
repetitions = 2,
project = "new")
# get the cross-entropy for all runs for K = 3
ce = cross.entropy(project, K = 3)
# get the cross-entropy for the 2nd run for K = 3
ce = cross.entropy(project, K = 3, run = 2)