8
$\begingroup$

To be honest, I was not even aware of the term "dummy variable trap" until a few days ago, but it seems like the term is popping up more and more frequently at CV (note chonological ordering).

Do we need a tag for this? Maybe look for a canonical answer (e.g., this one, though it goes into many other aspects of collinearity besides the "trap")?

$\endgroup$
  • 5
    $\begingroup$ This is mostly a question of how categorical variables should be encoded. We have a relevant tag already: categorical-encoding. What might be helpful is to make a [dummy-variable-trap] tag & make it a synonym of [ce]. $\endgroup$ – gung Jul 3 at 11:24
  • 2
    $\begingroup$ I think it's econometricians' or economists' jargon but (1) I would be happy to get better informed (2) that's not a criticism, just a description. But as you say, it's not everyone's standard jargon, which gives me a little bias against making it a tag. $\endgroup$ – Nick Cox Jul 3 at 17:57
  • 1
    $\begingroup$ FWIW I put a bounty on the linked answer by @Silverfish. $\endgroup$ – amoeba Jul 3 at 18:31
  • 3
    $\begingroup$ @NickCox: I think that if a term is specific to a field, that would bias me towards creating a tag, because then we could explain exactly this in the tag wiki. (I am an incurable optimist: I still believe some people actually read those tag wikis. Someday I'm going to propose a new closure reason: "Question is completely answered in the tag wiki of one of its tags.") $\endgroup$ – Stephan Kolassa Jul 3 at 20:29
  • 2
    $\begingroup$ My bias is unreasonably that I can't get excited about tags whereas conversely I quite enjoy copy-editing which clearly is of little or no appeal to many. Seriously, I am all in favour of people who like working hard on tags doing what they like and do well. I've come across a case in another part of SE in which a poster got flak most unfairly for a post on Meta giving some generic advice relevant to particular software, say FOO, from people knowing nothing about FOO. So, they promptly put the same material in a tag wiki where it is safe as non-FOO people would never dream of looking there. $\endgroup$ – Nick Cox Jul 3 at 21:11
  • 3
    $\begingroup$ If you think it's an answer, I can convert my comment above. $\endgroup$ – gung Jul 4 at 12:21
  • 1
    $\begingroup$ @gung: I would very much appreciate it. $\endgroup$ – Stephan Kolassa Jul 4 at 13:43
  • $\begingroup$ I would really appreciate making the dummy variable trap as a synonym. It would help people not familiar with the topic. The answer to this question for example feels a little off until you realize that their talking about categorical encoding and multicollinearity. (When I first read it, I thought he was talking about something singularities in outlier detection. This is very silly, I now realize, but still.) stats.stackexchange.com/questions/415841/… $\endgroup$ – mlane Jul 17 at 1:14
  • 1
    $\begingroup$ Update: I have created a dummy-variable-trap tag and started to retag a few questions at a time to avoid bump-flooding the landing page. I am a bit doubtful whether synonymizing it to categorical-encoding makes sense, so I'll leave that decision to people who actually have upvotes on the tag. $\endgroup$ – Stephan Kolassa Jul 17 at 9:10
9
$\begingroup$

This is mostly a question of how categorical variables should be encoded. (The 'dummy variable trap' is simply that there is perfect multicollinearity if you use a separate dummy code for every level of a categorical predictor when there is an intercept in the model; see my answer at: Qualitative variable coding in regression leads to “singularities”.) As such, we have a relevant tag already: , although it's also related to . What might be helpful is to make a [dummy-variable-trap] tag & make it a synonym of [categorical-encoding].

$\endgroup$
  • 2
    $\begingroup$ Please add to ... if you use a separate dummy code for every level of a categorical predictor the qualification "if there is an intercept in the model". Omission of that seems to confuse some people. Also, maybe, add "in the context of unregularized linear or generalized linear(ish) models", as removing one dummy should not be done when regularizing (see stats.stackexchange.com/questions/231285/…) and neither with trees or other very unlinear models. $\endgroup$ – kjetil b halvorsen Jul 6 at 18:49
3
$\begingroup$

I'm a little skeptical that a dummy-variable-trap tag will be useful since it applies to the answer, rather than the question. In other words, if you knew enough to tag your question with "dummy variable trap", wouldn't you also be 99% of the way to figuring out the answer?

$\endgroup$
  • 2
    $\begingroup$ +1 I think it's a good point. $\endgroup$ – amoeba Jul 31 at 19:08
  • $\begingroup$ But see should tags refer to the answer as well as the question? $\endgroup$ – kjetil b halvorsen Jul 31 at 19:50
  • $\begingroup$ When the question is "How do I handle <situation>?" and the answer is something like "Use a GAM", I agree it makes sense to add the GAM tag to the question. Here though, who is going to search for dummmy-variable-trap? $\endgroup$ – Matt Krause Jul 31 at 21:13
  • $\begingroup$ I see your point, but note that we have 35 questions containing "dummy variable trap". Skimming through them gives at least me the impression that there are indeed people out there who know what the DVT is, but are unsure about how to handle it. Or whether what they have encountered is actually a DVT. So I still believe the tag is useful. $\endgroup$ – Stephan Kolassa Aug 9 at 16:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .