# A short list of math/stats results useful in our work

#### Jan 25, 2007

A derivation for Armitage’s trend test for the 2×3 genotype table

#### Feb 6, 2007

A very short R code for testing HWE Measures of Linkage Disequilibrium :

[code lang="r"]
HWE.test=function(als, counts=apply(als, 1, sum)){
# als is an nx2 matrix of allele counts
no.als=2*nrow(als)
t1=table(counts)
p=(2*t1+t1)/no.als
cat("p",p,"\n")
e0=p^2*no.als; e1=2*p*(1-p)*no.als; e2=(1-p)^2*no.als
es=c(e0, e1, e2)
chi.sq=sum((es-t1)^2/(es))
pchisq.new=1-pchisq(chi.sq, 1)
return(pchisq.new)
}
[/code]

#### March 15, 2007

In this section we show the derivation of D’ and the relationship between D’ and R.

#### June 5, 2007

Some R code to do a quick sample size estimate for genetic association using case-control studies. Please note that this code contains a parameter that can be adjusted to allow sample size correction under the assumption that the p-values will be adjusted with the Bonferronni correction. A drawback is that the code assumes that the researcher knows the mode of inheritance of the trait.

June 6, 2007 Some R code to do a quick power curve for genetic association using case-control studies. Given the accepted probability of Type I error, disease prevalence, mode of inheritance, and sample size, this returns a curve of power vs. relative risk given 2 disease alleles. Please note that this code contains a parameter that can be adjusted to allow power estimate under the assumption that the p-values will be adjusted with the Bonferronni correction. A drawback is that the code assumes that the researcher knows the mode of inheritance of the trait. Result of running the code will be a graphic like the one shown below.

## Follow us   