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

Re: st: question

From   Maarten buis <>
Subject   Re: st: question
Date   Tue, 3 Nov 2009 16:13:01 -0800 (PST)

--- Maarten Buis wrote:
> this is because these numbers are going to HUGE, so huge
> that in many cases a computer can't contain that number. This
> to me suggest a conceptual error rather than a Stata error:
> why do you want to do this?

--- On Tue, 3/11/09, Tunga Kantarci wrote:
> In the context of my calculations the numbers I am
> considering do not get
> huge. So the problem is at least not about big numbers. 

That still leaves the question why you would want to do this. If 
you want people to help you, you should answer their questions. These questions are not asked to annoy you but to diagnose the problem and
to find solutions. Ignoring those question is discourteous and not in 
your interest.

Having re-read your question I am guessing that you are dealing with
the following problem: You estimated a linear regression on an explained
variable that has been log-transformed and you are trying to get
predictions and standard errors in the original non-transformed metric.
If that is the case than there is a much simpler and much more elegant
solution to that problem.

The problem is that with OLS you model E(log(y)), the average of the 
logarithm of y. The logarithm is a non-linear transformation, so it 
matters whether you first take the log and than compute the mean, or 
first compute the mean and than compute the log. The alternative is 
to model log(E(y)), the log of the average of y, instead, and this 
exactly what -glm- with the log link (option -link(log)-) does.

The advantage of -glm- is that if you exponentiate the right hand 
side and the left hand side (specify the -eform- option or predict 
the exponentiated linear predictor) you get results in terms of the original unit of y, and the same is not true of OLS. You can use
-adjust- to get predicted values at specific values of the 
explanatory variables and their confidence interval, so no further
programming or calls to -nlcom- are necessary. Below is an example
of this approach:

*----------- begin example -----------
sysuse auto, clear
glm price foreign mpg, link(log)
adjust mpg, by(foreign) ci exp
*------------ end example ------------
( For more on how to use examples I sent to statalist see: )

-- Maarten

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


*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index