04-05-2013 10:23 AM
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;
proc glimmix data=test;
model y= pwp /dist=binary link=logit ddfm=kr2 solution ;
random _residual_ / subject=id;
output out=out1 pred(ilink)=predicted; *??;
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.
04-07-2013 12:06 PM
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?
04-07-2013 12:23 PM
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.
04-07-2013 12:50 PM
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?
04-07-2013 01:16 PM
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.
06-20-2013 02:02 PM
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.
Need further help from the community? Please ask a new question.