howrigan / trio_sequence_analysis

3 stars 4 forks source link

95% CI of proportion ratio in prop.test #2

Open LIKUOKUO opened 4 years ago

LIKUOKUO commented 4 years ago

Dear Dr. Howrigan. Could I ask another detailed method about you paper. In gene set enrichment section, you used binom.test and prop.test, and calculated proportion ratio of case genes in specific gene set comparing to control and expected model. Supplementary Data 9 not offer 95% CI of proportion ratio which was used to plot in your figure (eg: Fig3, Fig4).

For example, binom,test of gene with LoF: lof_expected (0.009583437), lof_actual (0.021052632), lof_enrichment (0.021052632/0.009583437=2.196772461), lof_low95(0.007764205), lof_hi95 (0.045257165). I can calculate 95%CI enrichment using lof_low95 and lof_hi95 divided by lof_expected. But I don't know how to calculate 95% CI proportion ratio of prop.test which just provide 95% CI of different between case and control proportion. For example, how to calculate 95% CI of proportion ratio in follow test: unaff_lof_prop (0.005102041), lof_prop_enrichment (0.021052632/0.005102041=4.126315789), lof_prop_low95 (-0.003473014), lof_prop_hi95 (0.035374196).

Thank you in advance for your help!

howrigan commented 4 years ago

Great question - yes the confidence intervals are a bit convoluted. They are based on the absolute proportion difference (and what comes directly from prop.test in R), but can be converted to ratios too. The best way to think about it is the estimate/lowCI/highCI are all measuring how different the observed proportion from one group (say SCZ affected) differs from another group (SCZ unaffected). Thinking in percentage makes it a little easier

Observed proportions (rounded and turned into percentages) Affected LoF = 2.1% Unaffected LoF = 0.5% Proportion Difference (2.1 - 0.5) = 1.6%
Observed Ratio (2.1% / 0.5%) = 4.2-fold Or better yet: Observed Ratio ((0.5 + 1.6) / 0.5) = 4.2-fold

The 95% CI around the 1.6% difference is: lower 95% = -0.3% lower 95% of Proportion Difference (0.5 - 0.3) = 0.2%
upper 95% = 3.5% lower 95% of Proportion Difference (0.5 + 3.5) = 4%

And you can insert them into the same ratio calculation as the observed proportion Observed lower 95% CI Ratio ((0.5 - 0.3) / 0.5) = 0.4-fold Observed upper 95% CI Ratio ((0.5 + 3.5) / 0.5) = 8-fold