0
$\begingroup$

Suppose I have the following relationship

$$y = A + B + \epsilon$$

where $A$ is a categorical variable with $2$ levels and $B$ is categorical with $3$ levels. However when $A = 1$, $B=1$, always. How do I set up the dummies to fit a linear regression model?

$\endgroup$
5
  • 1
    $\begingroup$ This sounds like a case of measuring the same quantity twice but in different ways, something akin to measuring a distance in feet and then in meters. $\endgroup$
    – Dave
    Jul 15 at 20:02
  • $\begingroup$ I think we’d need more information to help you. What do these variables represent? Without more information, I would suggest dropping either A or B. $\endgroup$ Jul 15 at 20:07
  • $\begingroup$ @Thomas These are nested variables. Dropping one of them would be inadvisable. What we ought to be considering is whether there is any problem at all with standard methods of dummy coding. (There aren't.) $\endgroup$
    – whuber
    Jul 15 at 21:47
  • 1
    $\begingroup$ @whuber Of course. I was thinking about it too narrowly. I was imagining a situation where the OP was modeling, say, year and seasonal effects simultaneously. $\endgroup$ Jul 15 at 22:35
  • 1
    $\begingroup$ In R, you can fit this model with lm(y ~ A + B - 1, X), assuming the data frame X has variables named "A", "B", and "y". The point is that your condition is not collinearity. $\endgroup$
    – whuber
    Jul 15 at 22:40

Your Answer

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

Browse other questions tagged or ask your own question.