Learn R Programming

LEA (version 1.4.0)

cross.entropy: Cross-entropy criterion from snmf runs

Description

Return the cross-entropy criterion for the chosen runs with K ancestral populations. For an example, see snmf. The cross-entropy criterion is a value based on the prediction of masked genotypes to evaluate the error of ancestry estimation. The criterion will help to choose the best number of ancestral population (K) and the best run among a set of runs in snmf. A smaller value of cross-entropy means a better run in terms of prediction capacity. The cross-entropy criterion can be automatically calculated by the snmf function with the entropy option.

Usage

cross.entropy(object, K, run)

Arguments

object
A snmfProject object.
K
The number of ancestral populations.
run
A list of chosen run number.

Value

res
A list containing the cross-entropy criterion for the chosen runs with K ancestral populations.

See Also

geno snmf G Q

Examples

Run this code
### Example of analyses using snmf ###

# creation of the genotype file, genotypes.geno.
# It contains 400 SNPs for 50 individuals.
data("tutorial")
write.geno(tutorial.R, "genotypes.geno")

################
# runs of snmf #
################

# main options, K: (the number of ancestral populations), 
#        entropy: calculate the cross-entropy criterion, 
#        CPU: the number of CPUs.

# Runs with K = 3 with cross-entropy and 2 repetitions.
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)

Run the code above in your browser using DataLab