Programming the statistical procedures from SAS

How to plot regression line from mixed models in my observed values?

Reply
Occasional Contributor
Posts: 8

Re: How to plot regression line from mixed models in my observed values?

@Rick_SAS,

 

Yes, that makes sense. Is there a way to specify that the predicted values in the output are for trainer 1 and the mean values of the covariates? I realize the fit won't be very impressive, but this type of graph has been requested by my co-authors.

 

Thanks again for your help!

Katy

 

SAS Employee
Posts: 25

Re: How to plot regression line from mixed models in my observed values?

The predicted values produced by PROC MIXED are for the values of the categorical and continuous predictors present in the data.  You cannot change the values used to create the prediction - that really would not make a lot of sense.  The prediction for an observation in the input data set should be for the data in that observation.

 

You can get MIXED to give you extra predictions, though.  You can add observations to the DATA= data set that are at levels of the predictors that are of interest to you.  Set the value of the response value to missing.  Since the response is missing, MIXED will not use the information in those observations when estimating the parameters.  If only the response is missing, MIXED will produce predicted values and confidence intervals for those predictions.  You can use those predictions to create the plot you want using SGPLOT.  

Highlighted
SAS Super FREQ
Posts: 3,835

Re: How to plot regression line from mixed models in my observed values?

In short, @StatsMan's suggestion is equivalent to creating a sliced fit plot. Many SAS regression procedures support the STORE statement to store the model in a SAS item store. You can then use PROC PLM to create the plot, as shown in the linked article.

 

The article also shows how to create a sliced fit plot when you want to include the observations or when you are using a procedure that does not support the STORE statement. What you do is to create a data set that contains the "slice" you want to score on. As StatsMan says, you use missing values for the response. Then you score the data and create the plot of the predicted values.

 

How to create a sliced fit plot in SAS

Ask a Question
Discussion stats
  • 17 replies
  • 421 views
  • 6 likes
  • 5 in conversation