Hi folks;
I want to fit a repeated measure logistic regression with GLIMMIX and get the predicted class labels. The data was ordered by "id", the response is 0-1 coded variable "y", and there is one class variable "pwp". The code looks like this:
ods html close;
ods html;
proc glimmix data=test;
class pwp;
model y= pwp /dist=binary link=logit ddfm=kr2 solution ;
random _residual_ / subject=id;
output out=out1 pred(ilink)=predicted; *??;
run;
However I get confused about "OUTPUT keyword< (keyword-options) > <=name >" part of the code. There are four options available: 1. Linear predictor (default) 2. Marginal linear predictor (NOBLUP) 3. Predicted mean (ILINK) 4. Marginal mean (NOBLUP ILINK), and I don't know which of them should be used to calculate predicted class labels.
Any useful hints would be highly appreciated.
Issac
Read the SAS documentation for the OUTPUT statement in PROC GLIMMIX. It explains the differences among these four options.
Read the SAS documentation for the OUTPUT statement in PROC GLIMMIX. It explains the differences among these four options.
@1zmm
Thanks for the hints. Is there any way in GLIMMIX to build a model on a portion of the data (train set) and then apply it to the rest (test set) to get the predictions?
Issac
One way is to create a new SAS data set that contains both the training data set with nonmissing, known values of the dependent variable
and the test data set with missing values for the dependent variable. Run this new SAS data set through PROC GLIMMIX using the model you specify, and write the predictions for both the training data set and the test data set to a new output SAS data set.
Another way, recently introduced in SAS, is to write the training and the test data to separate data sets and to use the SCORE= option to create a model with the training data set specified in the DATA= option and apply it to the test data set specified in the SCORE option. I'm not sure whether PROC GLIMMIX has the SCORE= option, but check the documentation for your version of PROC GLIMMIX to see if it is available for your use.
@1zmm
Thanks for the prompt reply. For the second way, I found CODE statement in the GLIMMIX in which one can write data steps to compute predicted values of the fitted model. Is this work like SCORE= option in other SAS procedures or just something different?
Issac
If you have access to SAS/STAT version 12.1, the PROC GLIMMIX CODE statement seems to allow you to apply the results of an analysis of one data set to another data set to generate predictions in the same way as the SCORE= option in other SAS procedures.
I always delete the values of dependent variable in the test dataset and append them to the train dataset. So, in your case y = . for all test records. By just running GLIMMIX procedure for the entire data (train + test), GLIMMIX will automatically output the predicted y value for all records. I was able to get the same results by doing this.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.