2017-04-16 502 views
0

我正在尋求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; 

謝謝你的幫忙!

回答

0

簡短的回答是在「重複」語句的末尾添加一個選項「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; 

希望它有幫助。進一步閱讀:

  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. 佳佳,保羅·Logistic迴歸使用SAS®:理論與應用,第二版(頁226-234)。版權所有©2012,SAS Institute Inc.,Cary,美國北卡羅來納州。