英文:
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])
```
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论