SAS proc genmod与聚簇,乘法估算数据
我正在寻求SAS中使用log pro bingenial回归使用SAS Proc Genmod从SAS乘法估算的集群相关数据中获得风险比率估计值。我已经能够计算原始(非MI)数据的风险比率估计值,但似乎该程序在生成输出数据集时遇到困难,可以让我读入Proc Mianalyze。SAS proc genmod与聚簇,乘法估算数据
我包括重复的主题陈述,以便SAS将使用强健的方差估计。没有“重复主题”声明,ODS输出声明似乎工作得很好;但是,一旦我包含“重复主题”声明,我收到一条警告消息,说明我的输出数据集未生成。
如果genmod/mianalyze组合不合适,但希望看看我能否实现这个功能,我愿意使用此数据生成风险比率估计的其他方法和建议!如果可能的话,我更喜欢SAS,因为许可证访问问题对其他程序,如Stata和SUDAAN。我的代码如下,其中“seroP”是我的二项式结果,“int”是感兴趣的二项式独立变量(干预收到vs未收到),“tf5”是二项协变量,年龄是连续协变量,村指定cluster:
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 ;
repeated subject=village/ type=unstr;
estimate 'Beta' int 1 -1/exp;
ods output ParameterEstimates=sc.seroP;
Run;
proc mianalyze parms =sc.seroP;
class int tf5 ;
modeleffects int tf5 age village ;
run;
谢谢你的帮忙!
简短的回答是在“重复”语句的末尾添加一个选项“PRINTMLE”。但是你在这里发布的代码可能不会产生你真正想要的。因此,以下是更长的答案:
1.以下程序基于Windows的SAS 9.3(或更新版本)。如果您使用的是旧版本,则编码可能会有所不同。
2.对于PROC MIANALYZE,需要PROC GENMOD的三个ODS表而不是一个,即1)参数估计表(_est); 2)协方差表(_covb);和3)参数索引表(parminfo)。在PROC多重填补语句的第一行应该是这样的:
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)选项COVB在模型声明中,以获得消耗臭氧层物质的协方差表。 2)“重复”声明作为评论。 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;
在“重复”的声明,该选项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
- 佳佳,保罗·Logistic回归使用SAS®:理论与应用,第二版(页226-234)。版权所有©2012,SAS Institute Inc.,Cary,美国北卡罗来纳州。