【问题标题】:SAS proc genmod with clustered, multiply imputed dataSAS proc genmod,带有集群的多重插补数据
【发布时间】:2017-04-16 18:56:10
【问题描述】:

我正在寻求使用 SAS Proc Genmod 的对数二项式回归,从 SAS 中的多重插补集群相关数据中获得风险比估计值。我已经能够计算原始(非 MI)数据的风险比估计值,但似乎该程序在生成输出数据集以供我读入 Proc Mianalyze 时遇到了障碍。

我包含一个重复的主题声明,以便 SAS 将使用稳健的方差估计。如果没有“重复主题”语句,ODS 输出语句似乎工作得很好;但是,一旦我包含“重复主题”语句,我就会收到一条警告消息,指出我的输出数据集没有生成。

如果 genmod/mianalyze 组合不合适,我愿意接受其他方法和建议来使用这些数据生成风险比估计值,但我想看看我是否可以让它发挥作用!如果可能,由于对其他程序(如 Stata 和 SUDAAN)的许可访问问题,我更喜欢 SAS。我的代码如下,其中“seroP”是我的二项式结果,“int”是感兴趣的二项式自变量(收到干预与未收到干预),“tf5”是二项式协变量,年龄是连续协变量,村庄指定集群:

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;

感谢您的帮助!

【问题讨论】:

    标签: sas cluster-analysis imputation correlated


    【解决方案1】:

    简短的回答是在“重复”语句的末尾添加一个选项“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;
    

    希望它有所帮助。进一步阅读:

    1. SAS proc genmod with clustered, multiply imputed data
    2. http://www.ats.ucla.edu/stat/sas/v8/mianalyzev802.pdf
    3. http://analytics.ncsu.edu/sesug/2006/ST12_06.PDF
    4. Allison, Paul D. Logistic Regression Using SAS®:Theory and Application,第二版(第 226-234 页)。版权所有 © 2012,SAS Institute Inc.,美国北卡罗来纳州卡里。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-04
      • 1970-01-01
      相关资源
      最近更新 更多