Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Log transformation


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Log transformation
Date   Tue, 16 Aug 2011 12:42:11 +0200

On Tue, Aug 16, 2011 at 12:18 PM, Amy Jennings wrote:
>can I just check that I have substituted the glm command in the right way below? The adjusted means I am getting from the glm model seem different to what I would expect.
>
> xi:reg log_ins i.q5_adj age smoke bmi
> adjust age smoke bmi, by (q5_adj) se ci
>
> xi:glm ins i.q5_adj age smoke bmi, link(log)
> adjust age smoke bmi, by (q5_adj) se ci

A better way of asking this is to also mention what you expected and
how the Stata output is different from that. Now we just have to
guess.

The key part in the output is at the bottom " Key:  Linear
Prediction", so you are not getting the predicted ins (whatever that
may be) but the linear predictor. In both cases you need to add the
-exp- option (and remove the -se- option). The difference is that with
regress you will get in this case the adjusted geometric means (*),
while with -glm- you will get the adjusted arithmetic ("normal")
means.

Hope this helps,
Maarten

(*) This is not true in general, but just a feature of first computing
the logarithm, compute the mean, and than back-transform the mean
again. See Roger Newson (2003) "Stata tip 1: The eform() option of
regress". The Stata Journal, 3(4): 445.
<http://www.stata-journal.com/article.html?article=st0054>

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index