## Logistic regression with GLIMMIX

Solved
Regular Contributor
Posts: 180

# Logistic regression with GLIMMIX

Hello all,

I have a simulated data with the following structure:

Subject IDObservationOutcomeGroup
111T
121T
211C
220C
310T
320T
............

Or in words, I have subjects, with 2 observations each. Every observation is success / failure (1/0). There are two groups (Treatment / Control).

Since the data is simulated, I know the probability of '1' in the treatment group and I know the probability of '1' in the control group. I also know the correlation between the two observations within a subject.

Now I want to model it, and to get estimates which will be as close as possible to the values I know (assume I have simulated correctly).

My questions are:

1. How to set the GLIMMIX procedure to do what I want ?

2. How do I extract from the output the 2 probabilities (P(1|T) and P(1|C) and the correlation ?

I tried:

proc glimmix data = Simdata;

class ID Group;

model outcome(event='1') = Group / dist=binary solution;

random ID;

run;

I am not sure it's correct and not sure how to test my output (to extract the probabilities).

Should I have used a different estimation method ? (laplace)

Accepted Solutions
Solution
‎07-22-2015 08:58 AM
Posts: 2,655

## Re: Logistic regression with GLIMMIX

Try this:

proc glimmix data = Simdata;

class ID Group observation;

model outcome(event='1') = Group / dist=binary solution;

random observation/residual type=unr subject=ID;

run;

This models observation as a repeated measure on each ID, with an unstructured correlation matrix as the covariance structure.

Steve Denham

All Replies
Posts: 2,655

## Re: Logistic regression with GLIMMIX

You probably will want to shift to method=laplace (see Walt Stroup's book on generalized linear models) for this effort.

The solution here will give values on the logit scale.  To get probabilities, try adding an LSMEANS statement.

This should give the marginal estimates on both the logit scale and the original scale, which would look like a probability.  Shifting to method=laplace would give the conditional estimates.

Steve Denham

Regular Contributor
Posts: 180

## Re: Logistic regression with GLIMMIX

Thank you Steve. Your suggestion worked, I did get probabilities, which are close to what I began the simulation with.

The only problem I got left is the correlation. I have started with a correlation of 0.3 between two observations within a subject, I can't extract this number from the output. How shall I do that ?

The Covariance Parameter Estimates is 1.1381, if it helps.

Solution
‎07-22-2015 08:58 AM
Posts: 2,655

## Re: Logistic regression with GLIMMIX

Try this:

proc glimmix data = Simdata;

class ID Group observation;

model outcome(event='1') = Group / dist=binary solution;

random observation/residual type=unr subject=ID;

run;

This models observation as a repeated measure on each ID, with an unstructured correlation matrix as the covariance structure.

Steve Denham

🔒 This topic is solved and locked.

Discussion stats
• 3 replies
• 285 views
• 0 likes
• 2 in conversation