Stratified McNemar (TDT, sign) test for association studies

Share:

Description

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

Usage

1
2
3
4
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.

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.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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]<c(M(dP,dX,dQ, wP,wQ)^2),1])) }
}

Author(s)

Knut M. Wittkowski kmw@rockefeller.edu

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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)