Proc PLM 无法使用 Proc Reg 输出创建置信区间 (SAS)

Proc PLM can't create Confidence Intervals with Proc Reg output (SAS)

我已经使用 Proc Reg 和 Proc GLM 对一组训练数据进行线性回归。当我对测试数据集进行评分时,我只能使用 Proc PLM 在保存的 Proc GLM 模型上创建置信度 - Proc Reg 模型结果为空白(尽管是同一模型)

这只是关于 Proc Reg 是否与 Proc PLM 在生成测试数据的置信区间不兼容的问题。

以下代码可在任何机器上运行(生成虚拟数据以进行回归)

/* the original data; fit model to these values */
data A;               
input x y @@;
datalines;
1  4  2  9  3 20  4 25  5  1  6  5  7 -4  8 12
;

/* the scoring data; evaluate model on these values */
%let NumPts = 200;
data ScoreX(keep=x);
min=1; max=8;
do i = 0 to &NumPts-1;
   x = min + i*(max-min)/(&NumPts-1);     /* evenly spaced values */
   output;                                /* no Y variable; only X */
end;
run;

proc reg data=A outest=RegOut tableout;
   model y = x;    /* name of model is used by PROC SCORE */
   store work.proc_reg_model;
quit;

ods output ParameterEstimates=Pi_Parameters FitStatistics=Pi_Summary;
proc glm data=A;
   model y = x;    
   store work.proc_glm_model;     /* store the model */
quit;

proc plm restore=work.proc_glm_model;
   score data=ScoreX out=Pred predicted=yhat lcl=lower_pred_int lclm=lower_confidence_int ucl=upper_pred_int uclm=upper_confidence_int;  /* evaluate the model on new data */
run;

proc plm restore=work.proc_reg_model;
   score data=ScoreX out=Pred_lin_reg predicted=yhat lcl=lower_pred_int lclm=lower_confidence_int ucl=upper_pred_int uclm=upper_confidence_int;  /* evaluate the model on new data */
run;

我希望两种模型的 PROC PLM 程序输出相同的数据集。 proc reg 模型的 PROC PLM 会产生置信区间和预测区间的空白数据。可以看出,最后两个感兴趣的数据集是: pred_proc_reg(置信区间和预测区间的空白值) pred_proc_glm(置信区间和预测区间的填充值)

我认为您的问题可能与此有关 注意:来自 PROC REG STORE 声明文档:

Note: The information stored by the STORE statement in PROC REG is a subset of what is usually stored by other procedures that implement this statement.

In particular, PROC REG stores only the estimated parameters of the model, so that you can later use the CODE statement in PROC PLM to write SAS DATA step code for prediction to a file or catalog entry. With only this subset of information, many other postprocessing features of PROC PLM are not available for item stores that are created by PROC REG.