簡體   English   中英

無法使用SAS中的零膨脹Poisson回歸模型對測試集進行評分

[英]Can't score test set using zero inflated Poisson regression model in SAS

我已經使用proc genmod運行了零膨脹的Poisson模型,並且嘗試使用Proc PLM對測試數據集進行評分,但這給了我這個錯誤:

proc genmod data = train2;
class region  / param=glm;
model response = var1 var2 var3 var4 var5
                    / dist=zip;
                    zeromodel;
output out = zeropoisson_output predicted= estprobzip;
store zero_poisson;
run;


proc plm source=zero_poisson;
  score data = test2 out= pred_zip;
run;

錯誤:此版本的PLM過程不支持計零充氣模型。

關於如何解決這個問題的任何想法?

這將花費更多的精力,但是您始終可以使用ODS輸出選項來獲取參數估算值並從那里解析數據。 我從genmod上的SAS示例中獲取了一些示例數據,並在下面演示了保存系數並對其進行解析的概念。 輸出是一個.sas文件,可以將其包含在任何數據步驟中以對驗證樣本進行評分。

data drug;
   input drug$ x r n @@;
   datalines;
    A  .1   1  10   A  .23  2  12   A  .67  1   9
    B  .2   3  13   B  .3   4  15   B  .45  5  16   B  .78  5  13
    C  .04  0  10   C  .15  0  11   C  .56  1  12   C  .7   2  12
    D  .34  5  10   D  .6   5   9   D  .7   8  10
    E  .2  12  20   E  .34 15  20   E  .56 13  15   E  .8  17  20
    ;
run;

ods output ParameterEstimates = ZIP_COEFF_EST;
proc genmod data=drug;
      class drug;
      model r/n = x drug / dist = zip;
      zeromodel;
run;
ods output close;

data ZIP_COEFF_EST_Parsed;
    length equation $ 2500;
    set ZIP_COEFF_EST (rename=(estimate=coefficient)) end=last;
    where coefficient ne .;
    if upcase(Parameter) = "INTERCEPT" then do;
        equation = " = " || trim(left(put(coefficient,20.10)));
        output;
    end;
    else if LEVEL1 ne '' then do;
        equation = " + (" || trim(left(Parameter)) || " = '" || trim(left(LEVEL1)) || "') * (" || trim(left(put(coefficient,20.10))) || ")";
        output; 
    end;
    else do;
        equation = " + " || trim(left(Parameter)) || " * (" || trim(left(put(coefficient,20.10))) || ")";
        output;
    end;
    if last then do;
        equation=';';   
        output;
    end;
    keep equation;
run;

data _null_;
    set ZIP_COEFF_EST_Parsed;
    FILE  "C:/estimate_file.sas";;
    PUT equation;
run; 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM