alpha= 5e-8 # Type I error rate threshold= qchisq(1-alpha,1) # Chisquare threshold for significance threshold # beta = 0.01 # effect size in SD units # p = 0.5 # effect size # q2 = 2*p*(1-p)*beta^2 # phenotypic variance explained by SNP q2= 0.00 q2 n= 10000 ncp= n*q2/(1-q2) power= 1-pchisq(threshold,1,ncp) ncp power