Forecasting using SAS Forecast Server, SAS/ETS, and more

PROC MODEL: How can I get the data for the Cook's D graph in an output dataset

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 84
Accepted Solution

PROC MODEL: How can I get the data for the Cook's D graph in an output dataset

[ Edited ]

First a small disclaimer: I am asking this question as a statistical noob on behalf of a custormer of ours. Smiley Wink

We are running SAS 9.4 M3 (SAS/ETS 14.1)

 

The customer runs various fit analysis using PROC MODEL and one of the graphs that is being generated is the Cook's D graph

The question of the customer is: can I get the data that is being used to generate the Cook's D graph in an output dataset and link this back to my source data so I can filter outliers?

 

By using the ODS TRACE statement I have been able to derive - I think - the base data that is being used.

The code I have used (hopefully as a representative example) is:

ods trace on;
proc model data=sashelp.citimon;
   lhur = 1/(a * ip + b) + c;
   fit lhur;
   id date;
run;
ods trace off;

Attached a sample of part the output that is generated, specifically Panel 1 that contains the Cook's D graph.

Comparing the output in the log against the output my assumption is that the base data for the graphs can be obtained by adding the following statement just before the PROC MODEL statement:

ods output DiagnosticsPanel=work.panel;

However, it seems as if the dataset contains all the data (the dataset contains 36 variables) that is needed to create the graphs in Panel 1 (and 2?) and I could find no way to relate the data back to the source data. I was hoping that adding the option PLOT(ONLY)=COOKSD would reduce the number of variables in the output dataset but it - as maybe could be expected Smiley Embarassed - only reduced the number of graphs.

 

Hopefully someone can shed some light on this and help me help our customer.

TIA

 

 

 


ProcModel-Panel1.PNG

Accepted Solutions
Solution
‎07-05-2017 04:08 AM
Super User
Posts: 17,840

Re: PROC MODEL: How can I get the data for the Cook's D graph in an output dataset

[ Edited ]

The dataset includes two variables to help you match back to the original:

 

ID - count of obs from 1 to NObs

Actual - the observed value

_____RESIDUAL_RESIDUAL____MSE_WE - I think this is the Cook's D variable. 

 


Resa wrote:

First a small disclaimer: I am asking this question as a statistical noob on behalf of a custormer of ours. Smiley Wink

We are running SAS 9.4 M3 (SAS/ETS 14.1)

 

The customer runs various fit analysis using PROC MODEL and one of the graphs that is being generated is the Cook's D graph

The question of the customer is: can I get the data that is being used to generate the Cook's D graph in an output dataset and link this back to my source data so I can filter outliers?

 

By using the ODS TRACE statement I have been able to derive - I think - the base data that is being used.

The code I have used (hopefully as a representative example) is:

ods trace on;
proc model data=sashelp.citimon;
   lhur = 1/(a * ip + b) + c;
   fit lhur;
   id date;
run;
ods trace off;

Attached a sample of part the output that is generated, specifically Panel 1 that contains the Cook's D graph.

Comparing the output in the log against the output my assumption is that the base data for the graphs can be obtained by adding the following statement just before the PROC MODEL statement:

ods output DiagnosticsPanel=work.panel;

However, it seems as if the dataset contains all the data (the dataset contains 36 variables) that is needed to create the graphs in Panel 1 (and 2?) and I could find no way to relate the data back to the source data. I was hoping that adding the option PLOT(ONLY)=COOKSD would reduce the number of variables in the output dataset but it - as maybe could be expected Smiley Embarassed - only reduced the number of graphs.

 

Hopefully someone can shed some light on this and help me help our customer.

TIA

 

 

 


 

 

 

 

 

View solution in original post


All Replies
Solution
‎07-05-2017 04:08 AM
Super User
Posts: 17,840

Re: PROC MODEL: How can I get the data for the Cook's D graph in an output dataset

[ Edited ]

The dataset includes two variables to help you match back to the original:

 

ID - count of obs from 1 to NObs

Actual - the observed value

_____RESIDUAL_RESIDUAL____MSE_WE - I think this is the Cook's D variable. 

 


Resa wrote:

First a small disclaimer: I am asking this question as a statistical noob on behalf of a custormer of ours. Smiley Wink

We are running SAS 9.4 M3 (SAS/ETS 14.1)

 

The customer runs various fit analysis using PROC MODEL and one of the graphs that is being generated is the Cook's D graph

The question of the customer is: can I get the data that is being used to generate the Cook's D graph in an output dataset and link this back to my source data so I can filter outliers?

 

By using the ODS TRACE statement I have been able to derive - I think - the base data that is being used.

The code I have used (hopefully as a representative example) is:

ods trace on;
proc model data=sashelp.citimon;
   lhur = 1/(a * ip + b) + c;
   fit lhur;
   id date;
run;
ods trace off;

Attached a sample of part the output that is generated, specifically Panel 1 that contains the Cook's D graph.

Comparing the output in the log against the output my assumption is that the base data for the graphs can be obtained by adding the following statement just before the PROC MODEL statement:

ods output DiagnosticsPanel=work.panel;

However, it seems as if the dataset contains all the data (the dataset contains 36 variables) that is needed to create the graphs in Panel 1 (and 2?) and I could find no way to relate the data back to the source data. I was hoping that adding the option PLOT(ONLY)=COOKSD would reduce the number of variables in the output dataset but it - as maybe could be expected Smiley Embarassed - only reduced the number of graphs.

 

Hopefully someone can shed some light on this and help me help our customer.

TIA

 

 

 


 

 

 

 

 

Frequent Contributor
Posts: 84

Re: PROC MODEL: How can I get the data for the Cook's D graph in an output dataset

Hi @Reeza,

Thank you for your quick reply.

Based on your information (created a needle plot using the variable you indicated) it seems you have this correct.

I will confirm with the customer tomorrow and if your information is correct will mark your reply as a solution.

 

It would have been nice if they would have given the column a somewhat more meaningfull name though Smiley Tongue

Will keep you posted

--Resa

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 145 views
  • 1 like
  • 2 in conversation