Description Usage Arguments Details Value Author(s) Examples
Determine correlation induced by adjusting Z scores for discrepancy in subgroup frequency
1 | syscov(v, n1, n2, nc)
|
v |
the proportion of subgroup 1 in the population |
n1 |
number of samples of subgroup 1 |
n2 |
number of samples of subgroup 2 |
nc |
number of controls |
If a particular sub-trait within a disease has a frequency of v in the population, but is comparatively oversampled (or undersampled) in the case group to a frequency n, the observed effect size between cases and controls will be biased toward the effect size in the oversampled subgroup, compared to an observed effect size in a study where the subgroup frequency matches that of the population.
This can be corrected for by computing Z_a' = Z_a + (v-n)Z_d. However, this induces a systematic non-zero covariance between Z_a and Z_d.
This function evaluates the resultant covariance
estimated covariance
Chris Wallace and James Liley
1 2 3 4 5 6 7 8 9 10 11 12 | n1=100; n2=500; nc=1000; v=0.8
M=runif(1000,0,0.5) # population MAFs at 1000 SNPs
G1=rbinom(1000,2*n1,M)/(2*n1) # observed MAF at n1 (diploid) samples in subgroup 1
G2=rbinom(1000,2*n2,M)/(2*n2) # observed MAF at n2 (diploid) samples in subgroup 2
Gc=rbinom(1000,2*nc,M)/(2*nc) # observed MAF at nc (diploid) controls
Xd= G1 - G2 # adjusted MAF differences between case and control group
Xa= (v*G1 + (1-v)*G2) - Gc # adjusted MAF differences between case and control group
Zd= Xd/sqrt(M*(1-M)*(1/(2*n1) + 1/(2*n2))) # Z score, subgroup 1 vs subgroup 2
Za= Xa/sqrt(M*(1-M)*((v^2)/(2*n1) + ((1-v)^2)/(2*n2) + 1/(2*nc)))
cov(Zd,Za)
syscov(v,n1,n2,nc)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.