1
$\begingroup$

If I have a categorical variable with three levels (CatXVar) that I recode into two dummy variables (NYXVar and BostonXVar)such that:

YVar ContXVar  CatXVar NYXVar BostonXVar
0.23 10        NY      1      0
0.1  22.3      Boston  0      1
0.52 11.9      London  0      0

and I want to see whether CatXVar affects the significance of any relationship between YVar and ContXVar, should I run two separate regressions of:

Yvar ~ ContXVar + NYXVar

and

Yvar ~ ContXVar + BostonXVar

or should I run the regression as:

Yvar ~ ContXVar + NYXVar + BostonXVar
$\endgroup$
  • $\begingroup$ If you exclude the intercept from your model you can run it using CarXVar as the predictor. $\endgroup$ – Mike Hunter Nov 1 '15 at 19:32
  • $\begingroup$ I've read that I should convert k-level categorical variables into k-1 binary dummy variables though? $\endgroup$ – Kaleb Nov 2 '15 at 8:06
  • $\begingroup$ Not if you don't have an intercept. $\endgroup$ – Mike Hunter Nov 2 '15 at 9:52
  • $\begingroup$ How do I get rid of the intercept in R with glm? $\endgroup$ – Kaleb Nov 2 '15 at 12:50
  • 1
    $\begingroup$ You can remove the intercept by including -1 in the model specification. You might want to consider reading this before doing that. Yvar ~ ContXVar + NYXVar + BostonXVar seems to be the safe bet here. $\endgroup$ – HorseOfTheYear Nov 4 '15 at 14:35
1
$\begingroup$

You can remove the intercept, as suggested in the comments, by including -1 in the model specification. However, you might want to consider reading this before doing that.

Yvar ~ ContXVar + NYXVar + BostonXVar seems to be the safe bet here.

Running two separate regressions essentially means you're estimating two separate models as you don't account for the New York/Boston effect respectively.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.