st: Re: log of variables in xtreg

 From Stas Kolenikov To statalist@hsphsun2.harvard.edu Subject st: Re: log of variables in xtreg Date Tue, 22 Oct 2002 10:09:56 -0400 (EDT)

```The "significance" of the coefficient can only tell you something when the
model is correctly specified. If you have a nonlinear effect not captured
by your regresssors and / or transformation of your variables, then your
model simply fails to capture the way the data behaves.

Here's an example (quick and dirty, so it might not be as convincing as it
should :) ):

====

clear
set obs 100
set seed 99999
g lx = uniform()
g ly = -.3*lx + invnorm(uniform())
g y = exp(ly)
g x = exp(lx)

gr y x
reg y x

exit

====

The regression gives a positive and insignificant coefficient of x,
although from the way the data were generated, the logged variables have a
reasonably strong negative dependence.

The idea is that without logs, the model is not very well specified. The
error distribution would be heavily skewed, and I am not sure you would
get very impressive results with this distribution. The mean structure is
also likely to be nonlinear, so the errors would also have conditional
bias.

A pretty good way to get rid of at least some problems with skewness and
nonlinearity would be to try Box-Cox transformations, see -help boxcox-.
In my example,

boxcox y x , model(lambda)

restores the original lx and ly variables by saying that the preferred
transformation parameter is 0. I was not quite sure though what is the
regression related to the transformed model based on the output of
-boxcox-.

---                                    Stas Kolenikov
--       Ph.D. student in Statistics at UNC-Chapel Hill
- http://www.komkon.org/~tacik/  -- Stas.Kolenikov@unc.edu

* This e-mail and all attachments to it are not intended to provide any
* reasonable point of view and was transmitted to you in error. It
* should be immediately deleted by all recepients unless they really
* enjoy communicating with the author :). Other restrictions apply.

*
*   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/
```