BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ChuksManuel
Pyrite | Level 9

Dear programmers,

 

I want to use the estimate statement in proc genmod but my code is not giving me what i want.

My outcome is status (Yes vs No) . My predictors are dose ( 1 vs 0) and Time measurements (1, 2, 3 and 4). Simply put, the status of the subjects were taken at these 4 time points. I also want to include the interaction term between dose and time. 

The problem i have is specifying the estimate statement so that i can get the Odds Ratios.

Attached are my codes.

proc genmod data = newdata descending;
class ID dose time/PARAM=EFFECT DESCENDING ;
model status=dose time dose*time/dist=bin link=logit;
repeated subject=ID/type=ar(1) corrw covb modelse within=time;
estimate "dose" dose -1 1 / exp;
estimate "time4" time 1 0 0/exp; 
estimate "time3" time 0 1 0/ exp;
estimate "time2" time 0 0 1/exp;
ESTIMATE "time1" Time -1 -1 -1/ exp;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

This may be all wrong, as I usually don't use the EFFECT parameterization.  However, I think what you are getting from the ESTIMATE statements for time are equivalent to the LSMEANS.  Try inserting an LSMEANS statement to see if this is the case.  If it is, then you need to rewrite the ESTIMATEs as differences so that the exponentiated value is an odds ratio.  If it is not the case, then pay no attention to this part of the post.

What you might do is use the default GLM parameterization, and use LSMESTIMATE statements as follows:

proc genmod data = newdata descending;
class ID dose time;
model status=dose time dose*time/dist=bin link=logit;
repeated subject=ID/type=ar(1) corrw covb modelse within=time;
lsmestimate dose  "dose" -1 1 / exp;
lsmestimate time "time4 vs time1 "  -1 0 0 1, 
                 "time3 vs time1"   -1 0 1 0,
                 "time2 vs time1"   -1 1 0 0/exp;

run;

Since you are not asking for a SOLUTION in the model statement, I think this will give you what you are looking for.

 

SteveDenham

View solution in original post

5 REPLIES 5
SteveDenham
Jade | Level 19

This may be all wrong, as I usually don't use the EFFECT parameterization.  However, I think what you are getting from the ESTIMATE statements for time are equivalent to the LSMEANS.  Try inserting an LSMEANS statement to see if this is the case.  If it is, then you need to rewrite the ESTIMATEs as differences so that the exponentiated value is an odds ratio.  If it is not the case, then pay no attention to this part of the post.

What you might do is use the default GLM parameterization, and use LSMESTIMATE statements as follows:

proc genmod data = newdata descending;
class ID dose time;
model status=dose time dose*time/dist=bin link=logit;
repeated subject=ID/type=ar(1) corrw covb modelse within=time;
lsmestimate dose  "dose" -1 1 / exp;
lsmestimate time "time4 vs time1 "  -1 0 0 1, 
                 "time3 vs time1"   -1 0 1 0,
                 "time2 vs time1"   -1 1 0 0/exp;

run;

Since you are not asking for a SOLUTION in the model statement, I think this will give you what you are looking for.

 

SteveDenham

StatDave
SAS Super FREQ

See this note for computing odds ratios for a model including interaction. While PROC LOGISTIC is shown, the ideas apply to GENMOD with REPEATED as well. The main point being to use GLM parameterization so that you can use the LSMEANS statement which is by far the easiest and least error-prone way to estimate odds ratios. I strongly advise against using ESTIMATE (or CONTRAST) statements when doing simple comparisons like this since correctly determining contrast coefficients is difficult and attempts to do it intuitively invariably yields incorrect coefficients. If you particularly want the parameters of your model to have the interpretation imposed by effects coding, then simply fit the model both ways - once with PARAM=EFFECT just to get the parameter estimates and once with PARAM=GLM and the LSMEANS statement to get the odds ratios as shown in the note above. 

ChuksManuel
Pyrite | Level 9
Thanks! The notes were helpful.
ChuksManuel
Pyrite | Level 9
The suggesting did not work. I had to use R . Thanks
SteveDenham
Jade | Level 19

Curiosity reigns.  When you say the suggestion did not work, the cause could be one of several things.  Could you share your code and log?

 

SteveDenham

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

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.

Discussion stats
  • 5 replies
  • 787 views
  • 1 like
  • 3 in conversation