Your point about exp not being correct for the predicted proportion with a logit link is really helpful- I had wondered about that. I'll have a look at the references that you have suggested and see how it goes.
I'll also aim to work through your suggested code- as I said being reasonably new to stata and this field of study, it may take a while to get my head around it.
Thanks for your help,
Gina
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Austin Nichols
Sent: Wednesday, 25 February 2009 2:04 PM
To: [email protected]
Subject: Re: st: predicted proportions greater than 1 using -adjust- after GLM family(binomial) link (logit)
I mean:
sysuse nlsw88, clear
egen m=mean(married), by(race)
char _dta[omit] "prevalent"
qui xi: glm m i.age i.grade, family(bin) link (logit) r
unab v: _Igrade*
loc s
foreach i of loc v {
loc s "`s' `i'=0"
}
preserve
qui adjust `s' if e(sample), by(age) se replace
g p=invlogit(xb)
g ub=invlogit(xb+1.96*stdp*abs(1/xb-1/(1-xb)))
g lb=invlogit(xb-1.96*stdp*abs(1/xb-1/(1-xb)))
di as res "Adjusted for grade; predictions at grade=12"
li age p lb ub, noo sep(0)
restore
di as res "Unadjusted means by age"
mean m, over(age) nohe
and I would add an alternative calculation predicting over the whole
sample replacing age with each observed value of age in turn, but it
would make no difference in this silly example using faked data.
In any case, better to go down the demand system route:
http://www.stata-journal.com/sjpdf.html?articlenum=st0029
and see also
http://www.stata.com/meeting/snasug08/nelson_snasug08.pdf
On Tue, Feb 24, 2009 at 9:51 PM, Austin Nichols <[email protected]> wrote:
> Gina Bilenkij <[email protected]>:
> You should read
> http://www.stata-journal.com/sjpdf.html?articlenum=st0029
> for a more standard method of modeling expenditure shares.
>
> That said, it's not clear to me what you hope to do with your -adjust-
> call, but I am fairly certain what you have shown is not the actual
> code you are using. You should show an example of what you hope to
> achieve using data that is accessible to all (start with -sysuse- or
> -webuse-) and code that runs without error. One problem that is
> evident without data is that the exponentiated linear prediction e(xb)
> is not the predicted proportion with a logit link; invlogit(xb) is.
> To get predicted proportions and a rough idea of CI from -adjust-
> after -xi: glm- you could do something like:
>
> sysuse nlsw88, clear
> egen m=mean(married), by(race)
> char _dta[omit] "prevalent"
> qui xi: glm m i.age i.grade, family(bin) link (logit) r
> unab v: _Igrade*
> loc s
> foreach i of loc v {
> loc s "`s' `i'=0"
> }
> forv q=1/1 {
> di as res "Unadjusted means by age"
> mean m, over(age) nohe
> preserve
> qui adjust `s' if e(sample), by(age) se replace
> g p=invlogit(xb)
> g ub=invlogit(xb+1.96*stdp*abs(1/xb-1/(1-xb)))
> g lb=invlogit(xb-1.96*stdp*abs(1/xb-1/(1-xb)))
> di as res "Adjusted for grade; predictions at grade=12"
> li age p lb ub, noo sep(0)
> restore
>
> [You should also give the URL for an old thread if it is relevant--but
> I don't see how the threads at
> http://www.stata.com/statalist/archive/2007-08/msg00098.html
> http://www.stata.com/statalist/archive/2007-08/msg00108.html
> are relevant here]
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/