I am conducting a least square regression using the python library numpy. When I run OLS (ordinary least square regression) over just the variable IE6 I get this output (with the key takeaway being that the coefficient is negative):
=============================================================================
variable coefficient std. Error t-statistic prob.
==============================================================================
const -0.632626 0.184070 -3.436882 0.001209
IE6 -11.845141 8.695507 -1.362214 0.179360
==============================================================================
Models stats Residual stats
==============================================================================
R-squared 0.036488 Durbin-Watson stat 1.635514
Adjusted R-squared 0.016825 Omnibus stat 12.433490
F-statistic 1.855627 Prob(Omnibus stat) 0.001996
Prob (F-statistic) 0.179360 JB stat 43.784881
Log likelihood -47.743508 Prob(JB) 0.000000
AIC criterion 1.950726 Skew 0.052388
BIC criterion 2.026484 Kurtosis 7.538025
==============================================================================
Yet when I add two additional variables percent and percent_m, the sign of the coefficient switches to positive. Apparently, I don't understand the mechanics of OLS well enough, because this switch perplexes me.
Here is the output of the second regression:
==============================================================================
variable coefficient std. Error t-statistic prob.
==============================================================================
const -1.511714 0.417273 -3.622840 0.000725
percent 1.852263 0.710854 2.605689 0.012313
percent_m -2.657285 1.233789 -2.153760 0.036533
IE6 9.625211 6.499429 1.480932 0.145442
==============================================================================
Models stats Residual stats
==============================================================================
R-squared 0.282134 Durbin-Watson stat 1.896240
Adjusted R-squared 0.219711 Omnibus stat 8.682105
F-statistic 4.519698 Prob(Omnibus stat) 0.013023
Prob (F-statistic) 0.003660 JB stat 14.649562
Log likelihood -40.238818 Prob(JB) 0.000659
AIC criterion 1.774071 Skew 0.366255
BIC criterion 1.963466 Kurtosis 5.521377
==============================================================================