Description Usage Arguments Details Value Author(s) Examples
Compute correlation between z values arising from shared controls
1 | cor_shared(n0i, n0j, overlap, n1i, n1j)
|
n0i |
Number of controls in GWAS for principal phenotype |
n0j |
Number of controls in GWAS for conditional phenotype |
overlap |
Number of controls shared between studies |
n1i |
Number of cases in GWAS for principal phenotype |
n1j |
Number of cases in GWAS for conditional phenotype |
Uses a formula from Zaykin et al (2010)
Asymptotic correlation between z scores.
James Liley
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | n0i = 1500; n0j = 1200; n1i = 800; n1j = 700;
overlap = 1000;
cor_shared(n0i,n0j,n1i,n1j,overlap)
# Simulation
n_snps = 10000; sim_maf = runif(n_snps,min=0.1,max=0.5) # simulated MAF
sim_con_i = matrix(runif(n_snps*n0i),n_snps,n0i)<sim_maf # simulated genotypes for controls for phenotype i
sim_con_j = matrix(runif(n_snps*n0j),n_snps,n0j)<sim_maf; sim_con_j[,1:overlap]=sim_con_i[,1:overlap] # simulated genotypes for controls for phenotype j, with shared controls
sim_case_i = matrix(runif(n_snps*n1i),n_snps,n1i)<sim_maf; sim_case_j = matrix(runif(n_snps*n1j),n_snps,n1j)<sim_maf # simulated genotypes for cases
om0i=rowMeans(sim_con_i); om0j=rowMeans(sim_con_j); om1i = rowMeans(sim_case_i); om1j = rowMeans(sim_case_j) # observed minor allele frequencies
or_i = om0i*(1-om1i)/(om1i*(1-om0i)); or_j = om0j*(1-om1j)/(om1j*(1-om0j)) # Odds ratios
se_i = sqrt( (1/(2*om0i*n0i)) + (1/(2*(1-om0i)*n0i)) + (1/(2*om1i*n1i)) + (1/(2*(1-om1i)*n1i)) )
se_j = sqrt( (1/(2*om0j*n0j)) + (1/(2*(1-om0j)*n0j)) + (1/(2*om1j*n1j)) + (1/(2*(1-om1j)*n1j)) ) # Standard errors
effect_i = log(or_i)/se_i; effect_j = log(or_j)/se_j # Effect sizes
cor(effect_i,effect_j)
cor_shared(n0i,n0j,n1i,n1j,overlap)
cor(abs(effect_i),abs(effect_j))
cor_shared(n0i,n0j,n1i,n1j,overlap)^2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.