Hello,
when running a regression with factor variables, I encounter certain problems.
I made up an example using the auto dataset.
My problem basically is, that I do not want to report "empty results" in a regression, which of course occur if one interacts two (0/1) dummies. So reg y i.var1r##i.var2 is better done as reg y 1.var1##1.var2. However there might arise new collianrity.
First; I get new collinearity, that hasn't been there before.
Second, which I cannot reproduce that easy with the auto dataset, in my dataset I get really strange results:Using 1.var instead of i.var, I get totally different results and R^2 of 0.000. This is really puzzling to me.
Thank you very much in advance for your help.
FYI: I use Stat 12 on a Mac OS Sierra.
when running a regression with factor variables, I encounter certain problems.
I made up an example using the auto dataset.
My problem basically is, that I do not want to report "empty results" in a regression, which of course occur if one interacts two (0/1) dummies. So reg y i.var1r##i.var2 is better done as reg y 1.var1##1.var2. However there might arise new collianrity.
Code:
sysuse auto, clear gen hro=1 if (headroom ==1 | headroom ==3 | headroom ==5 ) recode hro (.=0) gen light =1 if weight <=3000 recode light (.=0) reg length (i.light##i.hro)##i.foreign, robust reg length (1.light##1.hro)##1.foreign, robust //So far: everything perfectly fine, i.e. there are exactly the same results reg length (i.light c.mpg i.hro)##i.foreign, robust reg length (i.light c.mpg 1.hro)##1.foreign, robust //So why is there *now* collinarity? reg length (i.light c.price i.hro)##i.foreign, robust reg length (i.light c.price 1.hro)##1.foreign, robust reg length (c.price i.light##i.hro)##i.foreign, robust reg length (c.price 1.light##1.hro)##1.foreign, robust
Second, which I cannot reproduce that easy with the auto dataset, in my dataset I get really strange results:Using 1.var instead of i.var, I get totally different results and R^2 of 0.000. This is really puzzling to me.
Thank you very much in advance for your help.
FYI: I use Stat 12 on a Mac OS Sierra.
Comment