Learn R Programming

muStat (version 1.7.0)

SMN.pvalue: Stratified McNemar (TDT, sign) test for association studies

Description

Performs an asymptotic or exact stratified McNemar/sign test using a notation adopted to genetic association studies.

Usage

SMN.pvalue(pP,qP, pX=0,qX=0, pQ=0,qQ=0, wP=0.25,wQ=0.25, exact=NULL) TDT.pvalue(pP,qP, pX,xX,qX, pQ,qQ, exact=FALSE) DMM.pvalue(pP,qP, xX, condvar=TRUE, exact=FALSE) MCN.pvalue(pP,qP, exact=FALSE)

Arguments

pP
a numeric value, number of children homozygous for allele “P” (“PP”) among parents of mating types “PP” and “PQ”. Corresponds to “a” or “0/1” in a classical $\code{2x2}$ table. Required.
qP
a numeric value, number of heterozygous children (“PQ”) among parents of mating types “PP” and “PQ”. Corresponds to “c” or “1/0” in a classical $\code{2x2}$ table. Required.
pX
a numeric value, number of children homozygous for allele “P” (“PP”) among parentso of mating types “PQ” and “PQ” (both heterozygous). Corresponds to “a” or “0/1” in a classical $\code{2x2}$ table.
xX
a numeric value, number of heterozygous children (“PQ”) among parentso of mating types “PQ” and “PQ” (both heterozygous). Corresponds to the sum of “b” and “d” or “0/0” and “1/1” in a classical $\code{2x2}$ table.
qX
a numeric value, number of children homogzygous for allele “Q” (“QQ”) among parentso of mating types “PQ” and “PQ” (both heterozygous). Corresponds to “c” or “1/0” in a classical $\code{2x2}$ table.
qQ
a numeric value, number of heterozygous children (“PQ”) among parents of mating types “PQ” and “QQ”. Corresponds to “c” or “1/0” in a classical $\code{2x2}$ table.
pQ
a numeric value, number of children homozygous for allele “Q” (“QQ”) among parents of mating types “PQ” and “QQ”. Corresponds to “c” or “0/1” in a classical $\code{2x2}$ table.
wP
relative weight to be assigned to children with one “PP” parent. Default: .25.
wQ
relative weight to be assigned to children with one “QQ” parent. Default: .25.
condvar
if FALSE, the variance is conditional on (“corrected for”) the observed ties, otherwise, the variance is the expected variance in the absence of ties, see Wittkowski (1988, 1998) and Randles (2001) for details.
exact
if TRUE, the exact p-value is computed unless the product of block sizes exceets 10^6, if NULL, the exact p-value is computed if the sum of block sizes is below 100, if FALSE, the exact p-value is never computed.

Value

p.value
the asymptotic or exact p-value of the test.

Null Hypothesis

The null hypothesis is that for any two observations chosen randomly from the same block (parental mating type), the probability that it falls into the first category (“PP”, “PP”, or “PQ”, respectively) is the same as the probability that it falls into the second category (“PQ”, “QQ”, or “QQ”, respectively).

Test Assumptions

Except for TDT.pvalue, the children are assumed to be randomly chosen from the population of children born to parents with the same parental mating type. The asymptotic p.value should be interpreted carefully. It is only a large-sample approximation whose validity increases with the size of the smallest of the groups and/or the number of blocks.

Algorithm

SMN.pvalue <- function(pP,qP, pX=0,qX=0, pQ=0,qQ=0, 
      wP=.25,wQ=.25, exact=NULL) {
  M <- function(P,X,Q, wP,wQ, e = 1, op = "+", f = function(x) x) {
    O3 <- function(X,Y,Z,Op) matrix(outer(outer(X,Y,Op),Z,Op))
    O3(wP^e*f(P), (1-wP-wQ)^e*f(X), wQ^e*f(Q), op) } exact <- (dP<-pP-qP)+(dX<-pX-qX)+(dQ<-pQ-qQ)<100 &&="" is.null(exact)="" ||="" exact="" if="" (((np<-pp+qp)*(nx<-px+qx)*(nq<-pq+qq)="">10^6) || !exact )
    return( 1-pchisq(
      M(dP,dX,dQ, wP,wQ)^2/              # Eq. (1) in Wittkowski (2002)
      M(nP,nX,nQ, wP,wQ, 2),1)[1])       # Eq. (2) in Wittkowski (2002)
  else {
    tb <- cbind(
      M(nP,nX,nQ, wP,wP, 0,"*", function(n) mu.dbinom(0:n, n, .5)),
      M(nP,nX,nQ, wP,wQ, 1,"+", function(n) (0:n)-(n:0) )^2)
    return(1-sum(tb[tb[,2]

Details

TDT.pvalue is given for historical purposes only. It should be deprecated, because it is based on the unrealistic assumption that the individual alleles (rather than children) are randomly chosen from the population of transmitted alleles.

Choosing weights (wP, wQ) as (.00, .50) or (.50, .00) maximises the sensitivity of the test to detect dominant or recessive alleles, respectivel.

References

Dixon, W.J., Mood, A.M. (1946) J Am Statist Assoc 41: 557-566 McNemar, Q (1947) Psychometrica 12: 153-157 Dixon, W.J., Massey, F.J.J. (1951) An Introduction to Statistical Analysis. New York, NY: McGraw-Hill Wittkowski, K. M. (1988) Journal of the American Statistical Association, 83: 1163-1170. Wittkowski, K. M. (1998) Biometrics, 54: 789-C791 Spielman, R.S., McGinnis, R.E., Ewens, W.J. (1993) Am J Hum Genet 52: 506-516. Wittkowski, K.M., Liu, X. (2002) Hum Hered 54: 157-164, 58: 59-62

See Also

friedman.test, binom.test, chisq.test, mcnemar.test, mantelhaen.test

Examples

Run this code

SMN.pvalues <- function(n, wP = 0.25, wQ = 0.25) {
  print(SMN.pvalue(
    n[1,1],n[1,2], n[2,1], n[2,3], n[3,2],n[3,3], wP, wQ, exact = FALSE))
  print(SMN.pvalue(
    n[1,1],n[1,2], n[2,1], n[2,3], n[3,2],n[3,3], wP, wQ, exact = TRUE))
}
TDT.pvalues <- function(n){
  print(TDT.pvalue(
    n[1,1],n[1,2], n[2,1],n[2,2],n[2,3], n[3,2],n[3,3], exact = FALSE))
  print(TDT.pvalue(
    n[1,1],n[1,2], n[2,1],n[2,2],n[2,3], n[3,2],n[3,3], exact = TRUE))
}   

  wP <- 0.25;  wQ <- 0.25

  n <- matrix(c(
      1,3,0,   wP, 
      1,0,1,(1-wP-wQ), 
      0,3,1,      wQ), ncol=4, byrow=TRUE)

  SMN.pvalues(n)
  TDT.pvalues(n)

  n[3,2] <- 1
  n[3,3] <- 3;  SMN.pvalues(n);  TDT.pvalues(n)

  n[2,2] <- 1;  SMN.pvalues(n);  TDT.pvalues(n)

  n[2,2] <- 3;  TDT.pvalues(n)
  n[2,2] <- 2;  TDT.pvalues(n)
  n[2,3] <- 3;  TDT.pvalues(n)

  SMN.pvalues(n, .25, .25)
  SMN.pvalues(n, .00, .50)
  SMN.pvalues(n, .50, .00)

Run the code above in your browser using DataLab