简短的回答是在“重复”语句的末尾添加一个选项“PRINTMLE”。但是您在此处发布的代码可能不会产生您真正想要的。因此,以下是更长的答案:
1.以下程序基于适用于 Windows 的 SAS 9.3(或更新版本)。如果您使用的是旧版本,则编码可能会有所不同。
2.对于PROC MIANALYZE,需要三个来自PROC GENMOD的ODS表而不是一个,即1)参数估计表(_est); 2)协方差表(_covb); 3)参数索引表(parminfo)。 PROC MIANALYZE 语句的第一行应如下所示:
PROC MIANALYZE parms = ~_est covb = ~_covb parminfo=parminfo;
而~_est 指的是ODS 参数表,而~_covb 指的是ODS 协方差表。
有不同类型的 ODS 参数估计和协方差表。符号“~”应替换为一组特定的 ODS 表,这将在下一部分中讨论。
3.从PROC GENMOD,可以生成三组不同的ODS参数和协方差表。
3a) 第一组表来自非重复模型(即,没有“重复”语句)。在您的情况下,它看起来像:
Proc GenMod data=sc.wide_mip descending ; by _Imputation_;
…
MODEL seroP= int tf5 age/dist=bin Link=logit COVB; /*adding the option COVB*/
/*repeated subject=village/ type=unstr;*/
/*Note that the above line has been changed to comments*/
…
ODS OUTPUT
/*the estimates from a non-repeated model*/
ParameterEstimates=norepeat_est
/*the covariance from a non-repeated model*/
Covb = nonrepeat_covb
/*the indices of the parameters*/
ParmInfo=parminfo;
Run;
需要注意的是,1)在MODEL语句中增加了选项COVB,从而得到ODS协方差表。 2) “重复”语句被放置为 cmets。 3) “~_est”表被命名为“nonrepeat_est”。同样,表“~_covb”被命名为“nonrepeat_covb”。
3b) 第二组表格包含来自重复模型的基于模型的估计。在您的情况下,它看起来像:
…
MODEL seroP= int tf5 age/dist=bin Link=logit;
REPEATED subject=village/ type=un MODELSE MCOVB;/*options added*/
…
ODS OUTPUT
/*the model-based estimates from a repeated model*/
GEEModPEst=mod_est
/*the model-based covariance from a repeated model*/
GEENCov= mod_covb
/*the indices of the parameters*/
parminfo=parminfo;
Run;
在“REPEATED”语句中,选项 MODELSE 是生成基于模型的参数估计,而 MCOVB 是生成基于模型的协方差。如果没有这些选项,将不会生成相应的 ODS 表(即 GEEModPEst 和 GEENCov)。请注意,ODS 表名称与前一种情况不同。在这种情况下,表是 GEEModPEst 和 GEENCov。在前一种情况下(非重复模型),表是 ParameterEstimates 和 COVB。在这里,~_est 表被命名为“mod_est”,代表基于模型的估计。同样,~_covb 表被命名为“mod_covb”。 ParmInfo 表与之前模型中的相同。
3c) 第三组包含经验估计,同样来自重复模型。经验估计也称为 ROBUST 估计。听起来这里的结果就是你想要的。它看起来像:
…
MODEL seroP= int tf5 age/dist=bin Link=logit;
REPEATED subject=village/ type=un ECOVB;/*option changed*/
…
ODS OUTPUT
/*the empirical(ROBUST) estimates from a repeated model*/
GEEEmpPEst=emp_est
/*the empirical(ROBUST) covariance from a repeated model*/
GEERCov= emp_covb
/*the indices of the parameters*/
parminfo=parminfo;
Run;
您可能已经注意到,在“重复”语句中,选项更改为 ECOVB。这样,将生成经验协方差表。生成经验参数估计不需要任何东西,因为它们总是由程序生成。 ParmInfo 表与前面的情况相同。
4.放在一起,其实可以同时生成三组表。唯一的事情是,应该添加一个选项“PRINTMLE”,以便在重复项到位时从非重复模型生成估计。合并后的程序如下所示:
Proc GenMod data=sc.wide_mip descending ; by _Imputation_;
Class int (ref='0') tf5 (ref='0') village /param=ref ;
weight weight;
Model seroP= int tf5 age /
dist=bin Link=logit COVB; /*COVB to have non-repeated model covariance*/
repeated subject=village/ type=UN MODELSE PRINTMLE MCOVB ECOVB;/*all options*/
estimate 'Beta' int 1 -1/exp;
ODS OUTPUT
/*the estimates from a non-repeated model*/
ParameterEstimates=norepeat_est
/*the covariance from a non-repeated model*/
Covb = nonrepeat_covb
/*the indices of the parameters*/
ParmInfo=parminfo
/*the model-based estimates from a repeated model*/
GEEModPEst=mod_est
/*the model-based covariance from a repeated model*/
GEENCov= mod_covb
/*the empirical(ROBUST) estimates from a repeated model*/
GEEEmpPEst=emp_est
/*the empirical(ROBUST) covariance from a repeated model*/
GEERCov= emp_covb
;
Run;
/*Analyzing non-repeated results*/
PROC MIANALYZE parms = norepeat_est covb = norepeat_covb parminfo=parminfo;
class int tf5 ;
modeleffects int tf5 age village ;
run;
/*Analyzing model-based results*/
PROC MIANALYZE parms = mod_est covb = mod_covb parminfo=parminfo;
class int tf5 ;
modeleffects int tf5 age village ;
run;
/*Analyzing empirical(ROBUST) results*/
PROC MIANALYZE parms = emp_est covb = emp_covb parminfo=parminfo;
class int tf5 ;
modeleffects int tf5 age village ;
run;
希望它有所帮助。进一步阅读:
- SAS proc genmod with clustered, multiply imputed data
- http://www.ats.ucla.edu/stat/sas/v8/mianalyzev802.pdf
- http://analytics.ncsu.edu/sesug/2006/ST12_06.PDF
- Allison, Paul D. Logistic Regression Using SAS®:Theory and Application,第二版(第 226-234 页)。版权所有 © 2012,SAS Institute Inc.,美国北卡罗来纳州卡里。