Date: Thu, 18 Oct 2007 09:30:10 -0700
Reply-To: Robin High <robinh@UOREGON.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robin High <robinh@UOREGON.EDU>
Subject: Re: help with an estimate statement in GENMOD
In-Reply-To: A<200710171759.l9HFjNru021481@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="UTF-8"
DJR,
When you enter a model statement in GENMOD like this:
model Y = time time*time time*STAGE time*time*STAGE / dist=B link=logit LRCI;
an Estimate statement needs to have the actual value of time "squared" with a time*time term such as:
ESTIMATE 'stage 1, time 2' int 1 time 2 time*time 4 time*stage 2 0 0 time*time*stage 4 0 0 ;
ESTIMATE 'stage 2, time 2' int 1 time 2 time*time 4 time*stage 0 2 0 time*time*stage 0 4 0 ;
ESTIMATE 'stage 3, time 2' int 1 time 2 time*time 4 time*stage 0 0 2 time*time*stage 0 0 4 ;
If you save these values in a dataset and average them, it will give you an average logit at time 2 across the three stages, which then you can convert to the average predicted response at time=2 with
prd_time_2 = exp(avg_logit)/ (1 + exp(avg_logit)) ;
assuming you are modeling Prob(Y=1). You can check these individual estimates match the xbeta term produced by the obstats option on the MODEL statement, although if the file is big, be sure to look at it with ODS as well, something like:
ODS OUTPUT ESTIMATES=est OBSTATS=obst;
ODS EXCLUDE estimates obstats;
PROC GENMOD
MODEL Y = ... / DIST=b link=logit lrci obstats;
ESTIMATE ' ' ... ;
Run;
Proc print data=est; run;
Proc print data=obst; where time=2; run;
This approach is analogous to the LSMEANS statement from MIXED with a continuous response, such as:
LSMEANS stage / at (time)=(2);
Which isn't available in GENMOD.
Robin High
University of Oregon
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of DJR
Sent: Wednesday, October 17, 2007 11:00 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: help with an estimate statement in GENMOD
Hello SAS-L subscribers:
I am trying to output an estimate from a generalized linear model fit in SAS
GENMOD. The model relates the binary response to a continuous variable
(time, in minutes: 1,2,...,60) and a categorical variable with 3 levels
(STAGE, listed in a class statement). The specific model of interest is:
model Y = time time*time time*STAGE time*time*STAGE / dist=B link=logit LRCI;
My goal is get an estimate of the response over a range of times with the
STAGE effects averaged-out. I am using an estimate statement to attempt
this. For example, at time=1, I have written the estimate statement as follows:
estimate “time=1†intercept 1
time 1
time*time 1
time*STAGE 0.33 0.33 0.33
time*time*STAGE 0.33 0.33 0.33;
for time=2:
estimate “time=2†intercept 1
time 2
time*time 4
time*STAGE 0.66 0.66 0.66
time*time*STAGE 1.33 1.33 1.33;
and I repeat this across the range of times I am interested in. I get the
estimates that I am after, except for the value of time=1, which gives “no
est.†I have used this code with similar data before. Because, the code
works (or seems to work) for other values of time, I suspected it was a
problem with the dataset, but I checked it and found no errors. Is this
approach to averaging out the stage effect correct (i.e., the coefficient in
the estimate statement being set to the value of time*time*0.333), and if
so, what might the problem at the of value time=1 be?
Thanks for the help.
DJR