How to use linear regression B/SE estimates into a new formula to calculate Wald Ratio method statistic?

58 Views Asked by At

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

1

There are 1 best solutions below

0
matthewSwilson On

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])
```