Learn R Programming

HWxtest (version 1.0.5)

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.
  • observedProbThe probability of the observed set under the HW null and with the allele counts fixed.
  • observedLLRThe log-likelihood ratio of the observed set
  • observedUThe observed U-score. Positive values indicate an excess of homozygotes and negative ones imply too many heterozygotes
  • observedX2The classicalchi-squaredstatistic

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
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