【发布时间】:2013-03-02 09:01:23
【问题描述】:
我想绘制两个变量之间的交互作用。
margins SentiSat_Rounded#PriceReduction
我收到以下错误:
'SentiSat_Rounded' not found in list of covariates
r(322);
变量存在于数据集中。此外,如果数据集中不存在变量,则会引发不同的错误,例如
variable X not found
您能否建议未出现在协变量列表中是什么意思?
为了找到协变量,我遇到了这段代码: 程序 covars,rclass 第 8 版
capture local Covars : colnames e(b)
if _rc error 301
tempname b
mat `b' = e(b)
tokenize `Covars'
local k = 0
forval j = 1/`= colsof(`b')' {
if "``j''" != "_cons" & `b'[1,`j'] != 0 {
local covars "`covars'``j'' "
local ++k
}
}
if `k' {
di as txt "{p}`covars'{p_end}"
return local covars "`covars'"
c_local covars "`covars'"
}
end
我跑了
covars
之后..在协变量列表中,上述变量未列出.. 该协变量列表是否与我的数据集中的变量不同? Stata 如何确定什么是协变量?
【问题讨论】:
-
margins命令需要经过一些估计才能使用,例如regress。您是先估算的吗? -
是的,我正在使用 xtmixed 模型进行估算...