syscov: syscov

Description Usage Arguments Details Value Author(s) Examples

View source: R/fit.3g.R

Description

Determine correlation induced by adjusting Z scores for discrepancy in subgroup frequency

Usage

1
syscov(v, n1, n2, nc)

Arguments

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

Details

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

Value

estimated covariance

Author(s)

Chris Wallace and James Liley

Examples

 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)

jamesliley/subtest documentation built on May 18, 2019, 11:21 a.m.