Hey there
Forgive me for the slow response, things have been somewhat hectic of late. I do appreciate the feedback you’ve sent, I’m typing this in a rush, hope it is of some help -
I made some updates, if you now reinstall the R package (devtools::install_github(‘MRCIEU/TwoSampleMR’)) then you will pull down the changes. Basically you can pre-supply the SNP-trait correlations for the exposure and outcome as two columns – r.exposure and r.outcome. If those aren’t provided then it will try to estimate based on p-value and sasmple size. So if you have any binary traits then you should supply those in the new columns.
A few notes about estimating SNP-trait correlations -
The get_r_from_pn() (for quantitative traits) has its own problems in that it might be numerically unstable at some low p-values. The estimation of r2 for binary traits is difficult, as I’m sure you are aware. The get_r_from_lor() (for binary traits) attempts to estimate the variance explained on the liability scale in an unascertained sample, following
Lee SH, Wray NR. Novel genetic analysis for case-control genome-wide association studies: quantification of power and genomic prediction accuracy. PLoS One. 2013;8(8):e71494.
Another problem with both is if GWAS hits are used from the discovery sample, which will have inflated effects due to winner’s curse. So ideally effect size estimates from independent replication samples (for the exposure variable) would be used.
Thanks for pointing out that the example is on CHD as an outcome – this is not ideal I think it must have been used just to illustrate the code – I will change it to something when I get a chance.
Hope this helps, best wishes
Gib