+ Reply to Thread
Results 1 to 3 of 3

Thread: coding - one categorical vs multiple dummy

  1. #1
    Points: 6,126, Level: 50
    Level completed: 88%, Points required for next Level: 24

    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    coding - one categorical vs multiple dummy




    Hi,
    Most things I read seem to suggest that when you have a categorical predictor in a regression analysis you should create k-1 dummy variables, where k is the number of categories.

    Typically when I do a regression in R, I simply have the one variable with each category/level numbered (i.e. 1,2,3,4 etc) and this seems to give me no problems.

    Why is there ever any need or benefit to creating multiple dummy variables?

    Thanks,
    Paul

  2. #2
    TS Contributor
    Points: 5,246, Level: 46
    Level completed: 48%, Points required for next Level: 104
    maartenbuis's Avatar
    Location
    Konstanz
    Posts
    372
    Thanks
    3
    Thanked 146 Times in 123 Posts

    Re: coding - one categorical vs multiple dummy

    If you enter your variable as a categorical variable you are in effect creating those dummies without realizing it. Doing it internally has the advantage that R knows that these dummies belong together, which can be helpful in post-estimation. The main reason why you see this in texts is that that is how you used to do this, and it is a good thing to realize and understand that that is what you are doing under the hood when entering a categorical variable. Moreover, there is some cool stuff you can do if you create your variables yourself.

  3. #3
    Points: 6,126, Level: 50
    Level completed: 88%, Points required for next Level: 24

    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: coding - one categorical vs multiple dummy


    Thanks Maarten.

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats