Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Equivalent variables but different results
From
Scott Merryman <[email protected]>
To
[email protected]
Subject
Re: st: Equivalent variables but different results
Date
Thu, 11 Jul 2013 09:06:32 -0500
sysuse auto , clear
gen dd=length*foreign
//list foreign i1.foreign dd c.length#i1.foreign
qui reg mpg dd foreign
est store a
qui reg mpg c.length#i1.foreign i1.foreign
est store b
est table a b,se stats(N r2_a)
produces:
----------------------------------------
Variable | a b
-------------+--------------------------
dd | -.31318503
| .07757267
foreign | 57.731718
| 13.132913
|
foreign#|
c.length |
Foreign | -.31318503
| .07757267
|
foreign |
Foreign | 57.731718
| 13.132913
_cons | 19.826923 19.826923
| .6745027 .6745027
-------------+--------------------------
N | 74 74
r2_a | .29321317 .29321317
----------------------------------------
legend: b/se
Where are the differences?
On Thu, Jul 11, 2013 at 8:46 AM, Yu Chen, PhD <[email protected]> wrote:
>
> Dear Statalist,
> I ran the following code, and made sure that dd is equivalent to
> c.length#i1.foreign, and foreign is equivalent to i1.foreign by using
> the list command.
> However, when I put the variables into regressions, I got very
> different results. I want to know why this happened.
> Thank you.
>
> sysuse auto , clear
> gen dd=length*foreign
> list foreign i1.foreign dd c.length#i1.foreign
> reg mpg dd foreign
> reg mpg c.length#i1.foreign i1.foreign
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/