Hello all,
I have a simulated data with the following structure:
Subject ID | Observation | Outcome | Group |
---|---|---|---|
1 | 1 | 1 | T |
1 | 2 | 1 | T |
2 | 1 | 1 | C |
2 | 2 | 0 | C |
3 | 1 | 0 | T |
3 | 2 | 0 | T |
... | ... | ... | ... |
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)
Thank you in advance !
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;
lsmeans group/ilink;
run;
This models observation as a repeated measure on each ID, with an unstructured correlation matrix as the covariance structure.
Steve Denham
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.
lsmeans group/ilink;
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
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.
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;
lsmeans group/ilink;
run;
This models observation as a repeated measure on each ID, with an unstructured correlation matrix as the covariance structure.
Steve Denham
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.