Learn R Programming

HWxtest (version 1.1.9)

observedProb: Compute observed statistics for a genotype count matrix

Description

#' Four measures of fit to Hardy-Weinberg for a given set of genotype counts may be computed.

  • observedProb The probability of the observed set under the HW null and with the allele counts fixed.

  • observedLLR The log-likelihood ratio of the observed set

  • observedU The observed U-score. Positive values indicate an excess of homozygotes and negative ones imply too many heterozygotes

  • observedX2 The classical “chi-squared” statistic

Usage

observedProb(c)

observedLLR(c)

observedU(c)

observedX2(c, returnExpected = F)

Arguments

c

Matrix of observed genotype counts. Each number should be a non-negative integer, and matrix is \(k x k\).

returnExpected

Used in observedX2 to indicate whether a matrix of expected numbers should be returned instead.

Value

the observed statistic

Examples

Run this code
# NOT RUN {
t <- vec.to.matrix(c(0,3,1,5,18,1,3,7,5,2))
observedStats <- c(observedProb(t), observedLLR(t), observedU(t), observedX2(t))
# }

Run the code above in your browser using DataLab