0

In Stata how to perform one-sample Mendelian randomization using the Wald ratio method for causal estimates, SE and P value? Is there a package or special command?

Essentially I want to perform regression of A on X, and then regression of B on X and then I want to calculate

  • B coefficient = B-coefficient of (A on X) divided by B-coefficient of (B on X)
  • The SE is a complicated formula including the square root of the sum of the (SE/B coefficient) of each of the 2 regressions ... perhaps there could be a formula I could use to derive this from the linear regressions?

Currently I'm manually using linear regression and reading off the B and SE estimates. However it's onerous doing this for every outcome and exposure

common sense
  • 3,775
  • 6
  • 22
  • 31
  • What the SE formula should be is quite beyond the scope of Stack Overflow. – Nick Cox May 30 '23 at 08:57
  • 1
    There might be a Stata package for this? `ivonesamplemr` https://remlapmot.github.io/talk/2022-01-20_onesamplemr-talk.pdf – braces May 30 '23 at 14:18

1 Answers1

1

You can use the stored results. Here's an example with Stata's built-in auto dataset, so you can replicate it:

```
sysuse auto.dta
reg price weight
matrix bweight = e(b)
matrix vweight = e(V)
reg price length
matrix blength = e(b)
matrix vlength = e(V)
gen bratio = bweight[1,1]/blength[1,1]
*I'm not sure what exactly you want for the SE's. Here's an example with the ratio:
gen vratio = sqrt(vweight[1,1])/sqrt(vlength[1,1])
```