jean997 / cause

R package for CAUSE
https://jean997.github.io/cause/
52 stars 15 forks source link

Consult #35

Closed adamber6 closed 11 months ago

adamber6 commented 1 year ago

Dear Prof. Jean, I am sorry to bother you. I have a problem when I when the cause. The error is as follows:

res <-cause(X=mydata,variants =top_vars,param_ests=params,force=TRUE) Estimating CAUSE posteriors using 1409 variants. Fitting confounder only model. Setting ranges Refining grid Fitting causal model. Setting ranges Refining grid Error in marge_dists(joint_post, params, priors, ranges) : all(unique(joint_post[[start_nm]]) %in% starts) is not TRUE In addition: Warning message: In cause(X = mydata, variants = top_vars, param_ests = params, force = TRUE) : I noticed that some of the variants you are running with have large p-values (> 0.01) but we are going forward anyway.

I have run the function several times and my code is right. Can you solve the problem for me? Thank you for your great help.

jean997 commented 1 year ago

Hi thanks for the post. I haven't seen this error before. Do you have a small data set you could share that reproduces the error?

zengyifan0928 commented 11 months ago

Dear Prof. Jean, I am sorry to bother you. I have a problem when I use the cACUSE with your example data. At first, when I wanted to merge GWAS of X1 and X2, there were error as below: Error in gwas_merge(X1, X2, snp_name_cols = c("rsid", "oldID"), beta_hat_cols = c("beta", : unused argument (pval_cols = c("P-value", "P-value")). Then, after the LD pruning process, more than 20000 SNP were left, which was inconsistent with your reports. Thirdly, we also met the error of "I noticed that some of the variants you are running with have large p-values (> 0.01) but we are going forward anyway.". Finally, we could not calculate the OR and 95%CI directly, how could I calculate the OR of the results? I have tried many times and could not solve these problems. I hope you could give me some suggestions. Thank you for your help.

jean997 commented 11 months ago

Hi there - thanks for posting the issue. I am not sure of the source of your problem. If you are getting the " unused argument (pval_cols = c("P-value", "P-value"))" issue, this means you are using an old version of CAUSE and should download the most recent version. See https://github.com/jean997/cause/issues/19

I repeated the example and got the same results. I did find that the original van der Haarst data has moved to

http://ftp.ebi.ac.uk/pub/databases/gwas/summary_statistics/GCST005001-GCST006000/GCST005194/CAD_META.gz

so I will update the example code. However, this data does not seem to have changed and I got the same results going through the example.

Can you make sure that you have used the same commands that are in the example? You can either start from the pre-merged data or use the link above instead of the old link for X2. If you do this from a clean R session (no history or session loaded) and still get different results, can you share your sessionInfo()?

zengyifan0928 commented 11 months ago

Thank you for your help. After upload the CAUSE to the 1.2.0.0335 version, I have solve the porblem of " unused argument (pval_cols = c("P-value", "P-value"))". Since the example analysis were based on version 1.2.0.0335, I suggest you address this issue in your examples page. Moreover, I still am confused of how to calculated the OR and its 95%CI which was not presented in the Step 5: Look at Results. In fact, we need OR, 95%CI, and P-value to compare the results of different Mendelian randomization methods. Could you tell me the details of how to calculate it or its code.

jean997 commented 11 months ago

Great glad you got it figured out. If you check the "look at results" section of the software tutorial you will find the instructions for generating credible intervals. CAUSE is a Bayesian method so it generates credible intervals not confidence intervals.

zengyifan0928 commented 11 months ago

Thank you for your help. In fact, I'm a surgeon. Therefore, I don't really know much about statistics. I see CAUSE as a solution to Mendelian randomization. However, when I use other methods for Mendelian randomization, the results are presented in the form of beta and se values or OR and 95% CI. So what I want to know is whether CAUSE can calculate the corresponding indicators. Could the gamma value also be converted to OR, and if so, exp^gamma? As an clinical, I focused not only on whether there was a causal relationship between exposure and outcome, but also on the strength of the causal relationship through the OR/RR value. I sincerely hope you can answer this question for me.

jean997 commented 11 months ago

The estimate produced by MR can be interpreted as a marginal odds ratio if the outcome is binary and the genetic associations with the outcome are measured by logistic regression. Here marginal means not adjusted for any other variables. You may be familiar with the idea that odds ratios are non-collapsible which means that the marginal odds ratio is not a weighted average of sub-group level odds ratios so it is important to know if you are estimating a marginal or conditional value.

In CAUSE, gamma estimates the MR effect so this is the marginal odds ratio under the conditions stated above. CAUSE does not produce a confidence interval because it is a Bayesian method. A 95% credible interval is an interval that contains 95% of the posterior probability, so this is a Bayesian measure of confidence. If you need to compare with a frequentist method, it is reasonable to compare the credible interval and the confidence interval. However, you should be aware that these have somewhat different interpretations.