如何将线性回归的B/SE估计值用于计算Wald比方法统计量的新公式?

huangapple go评论57阅读模式
英文:

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

问题

在Stata中,如何使用Wald比方法执行单样本的Mendelian随机化,以获得因果估计、SE和P值?是否有一个特殊的包或命令?

基本上,我想执行A关于X的回归,然后执行B关于X的回归,然后我想计算:

  • B系数 = (A关于X的B系数)除以(B关于X的B系数)
  • SE是一个复杂的公式,包括两个回归中每个(SE/B系数)的平方根之和...也许可以从线性回归中导出这个公式?

目前,我正在手动使用线性回归,并阅读B和SE的估计值。然而,对于每个结果和曝露来说,这是繁琐的工作。

英文:

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

得分: 1

你可以使用存储的结果。以下是一个示例,使用Stata内置的auto数据集,以便您可以复制它:

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])
英文:

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

huangapple
  • 本文由 发表于 2023年5月30日 00:03:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76358777.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定