Programming the statistical procedures from SAS

How to produce class labels in random logistic regression with proc GLIMMIX?

Accepted Solution Solved
Reply
Contributor
Posts: 65
Accepted Solution

How to produce class labels in random logistic regression with proc GLIMMIX?

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


Accepted Solutions
Solution
‎04-06-2013 03:21 PM
Regular Contributor
Posts: 152

Re: How to produce class labels in random logistic regression with proc GLIMMIX?

Read the SAS documentation for the OUTPUT statement in PROC GLIMMIX.  It explains the differences among these four options.

View solution in original post


All Replies
Solution
‎04-06-2013 03:21 PM
Regular Contributor
Posts: 152

Re: How to produce class labels in random logistic regression with proc GLIMMIX?

Read the SAS documentation for the OUTPUT statement in PROC GLIMMIX.  It explains the differences among these four options.

Contributor
Posts: 65

Re: How to produce class labels in random logistic regression with proc GLIMMIX?

@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

Regular Contributor
Posts: 152

Re: How to produce class labels in random logistic regression with proc GLIMMIX?

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.

Contributor
Posts: 65

Re: How to produce class labels in random logistic regression with proc GLIMMIX?

@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

Regular Contributor
Posts: 152

Re: How to produce class labels in random logistic regression with proc GLIMMIX?

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.

New Contributor
Posts: 2

Re: How to produce class labels in random logistic regression with proc GLIMMIX?

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.

☑ This topic is SOLVED.

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

Discussion stats
  • 6 replies
  • 233 views
  • 6 likes
  • 3 in conversation