Last active
June 29, 2021 21:41
-
-
Save nievergeltlab/57ab76dc5e5bc3db4115f2a185d73b0f to your computer and use it in GitHub Desktop.
HWE calculation in R, based on knowing the counts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nAA=76 | |
nAa=1501 | |
naa=7823 | |
n=nAA+nAa+naa | |
pA=(2*nAA+nAa)/(2*n) | |
pa=1-pA | |
obs= c(nAA,nAa,naa) | |
exp=c(n*pA^2,2*n*pA*pa,n*pa^2) | |
val=sum(((obs-exp)^2)/exp) | |
1-pchisq(val,df=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment