我在Stata中使用coefplot命令来绘制来自多个回归模型的系数和置信区间。我绘制了4个不同型号规格的相同系数(X)。
有一个模型规范(替代标准误差),我不知道如何在Stata中估计,但可以使用R进行估计。这意味着对于一个模型规范,我在R中有标准误差,但在Stata中没有。
有没有一种简单的方法来手动修改coefplot中的标准误差?
我的代码是:
coefplot A B C D, drop(_cons) xline(0) keep(X)如何在此代码中添加模型D中系数X的标准误差应为Z?
发布于 2021-04-29 18:45:39
您可以手动编辑e(V) (方差-协方差矩阵)和e(b)矢量。为此,定义一个程序:
est restore estimates1
capture program drop changeeV
program changeeV, eclass
tempname b V
matrix `b' = e(b)
matrix `V' = e(V)
matrix `V'[1,1] = 1.1 // Add values of new variance-covariance matrix
matrix `b'[1,1] = 10 // Add new coefficient vector
ereturn post `b' `V' // Repost new vectors
ereturn local cmd "reg outcome treatment covariates"
// Repost initial command (required)
end
changeeV // Execute program
est store eaX // Store new generated estimtes请注意,为了得到协方差矩阵,您需要从R中的输出中取标准误差的平方。祝好运!
https://stackoverflow.com/questions/67306907
复制相似问题