[R] help needed for HWE.exact in library "genetics"

David Duffy David.Duffy at qimr.edu.au
Fri Aug 22 23:41:11 CEST 2008


"Sun, Ying" asked:

> I have a genotype data for both case and controls and would
> like to calculate the HW p-value.  However, since the
> number of one genotype is 0, I got wierd result.  Would
> someone help me to figure it out?  Or confirm it's right?
> Thanks a lot.
...
> HWE.exact(g1)
>     Exact Test for Hardy-Weinberg Equilibrium
>     data:  g1
>     N11 = 71, N12 = 9, N22 = 0, N1 = 151, N2 = 9,
>     p-value = 1

Yes, that is correct.  Double check it by calculating the
goodness-of-fit chi-square for the same hypothesis:

p <- 151/160; q <- 1-p; 80*c(p^2,2*p*q,q^2)
[1] 71.253125  8.493750  0.253125
...

David Duffy.

-- 
| David Duffy (MBBS PhD)                                         ,-_|\
| email: davidD at qimr.edu.au  ph: INT+61+7+3362-0217 fax: -0101  /     *
| Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v



More information about the R-help mailing list