# Re: st: Code and info for log-transformation

 From "Austin Nichols" To statalist@hsphsun2.harvard.edu Subject Re: st: Code and info for log-transformation Date Fri, 16 Nov 2007 22:22:14 -0500

It seems the first several lines of my prior post were eaten by the
majordomo.  I have pasted them back in place below.  I recommended you
ssc inst transint
h transint

http://www.stata.com/statalist/archive/2007-11/msg00349.html
and here is more:

If y in a model like
y_i = X_i b + e_i
is skewed, it could be that e_i is not skewed (perhaps a var in X is
skewed), and in fact the distribution of errors is perfectly symmetric
and perhaps even normal, but either way, you can still run
reg y x*
since the Gauss-Markov theorem (that's the reason everyone uses
regression all the time) assumes only Var(e_i)=e for all i, which can
hold for arbitrary patterns of skewness in e_i.

If you are worried about heteroskedasticity, you can
reg y x*, r
but I guess most folks who claim to be worried about skewness are in

However, if you run
reg lny x*, r
you are assuming a different model of the form
ln(y_i) = X_i b + e_i
is valid, with different interpretations, or in other words:
y_i = exp(X_i b + e_i)
which is also the assumption in Poisson regression, so you could run
poisson y x*, r
reg lny x*, r
and there are various extensions (via -glm- or -nbreg- or -zip- or
-zinb-) or you can -ssc inst lognfit- for a ML estimator, or get the
GMM version of Poisson via
ssc inst ivpois, replace
ivpois y x*
which also allows you to add instrumental variables, and has an
updated help file with clickable examples.

> Hi Austin
> is it ok to kindly explain more your answer, because i am afraid i did
> not understand it well, i am still trying to learn the terms
> discussions?
> Thank you in advance and best regards

On Nov 16, 2007 3:08 PM, Austin Nichols <austinnichols@gmail.com> wrote:

Try:
ssc inst transint
h transint
to start, but note you need not transform y just because it is skewed.

> > > Dear STATA lister
> > > i am trying to find more info how to write command for
> > > log-transformation because i have skewed data?
> > >
> > > Or if you have any link to recommend to see?
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/