我正在尝试将代码从SAS转移到Stata。下面的logit在SAS中收敛(“注意:收敛标准(GCONV = 1E-8)满意”总是在日志中弹出),但我无法让stata版本收敛。如果有人知道我在stata代码中做错了什么,这将是非常有帮助的。
更正SAS代码:
proc logistic data=fit outest=beta;
by &by_vars;
weight wgtfnl;
model &dep_var = &varlist / ridging=relative lackfit;
output out=res_temp p=predicted c=chires;
run;
Stata代码不正确:
g `dep_var'_sas = (`dep_var'==0) // need to predict failure to match SAS output
egen group = group(`by_vars')
levelsof group
foreach num in `r(levels)'{
glm `dep_var'_sas `varlist' [pweight= wgtfnl] if group==`num', link(logit) ///
family(binomial) fisher(8) nrtolerance(1e-8) iterate(8)
}
谢谢, Ĵ