Learn R Programming

scrime (version 1.3.5)

rowHWEs: Rowwise Test for Hardy-Weinberg Equilibrium

Description

Tests for each row of a matrix whether the Hardy-Weinberg Equilibrium holds for the SNP represented by the row.

Usage

rowHWEs(x, levels = 1:3, affy = FALSE, check = TRUE)

Arguments

x

a matrix in which each row represents a SNP and each column a subject, where the SNPs can take the values specified by levels. NAs are allowed.

levels

a vector of length three specifying the values with which the three genotypes of each SNP are represented. It is assumed that the second element of levels represents the heterozygous genotype, whereas the first and the third element represent the homozygous genotypes. Ignored if affy = TRUE.

affy

logical specifying whether the SNPs in x are coded as in the Affymetrix standard output. If TRUE, levels = c("AA", "AB", "BB") will be used.

check

should some checks be done if, e.g., other than the specified levels are used in x? It is highly recommended to leave check = TRUE. Setting check = FALSE will reduce the computation time slightly.

Value

A list containing the values of the ChiSquare statistic for testing for deviation from HWE (stats) and the raw p-values (rawp) computed by employing the ChiSquare distribution with 1 degree of freedom.