+ Reply to Thread
Results 1 to 5 of 5

Thread: Calculating discrete changes

  1. #1
    Points: 2,427, Level: 29
    Level completed: 85%, Points required for next Level: 23

    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Calculating discrete changes



    Hi all,

    I have a quick stata question about computing the discrete changes of a dummy variable. I am using a logistic regression so I need to look at discrete changes because the coefficients aren't easy to interpret.

    I have three education dummies in my regression. They are "incomplete undergraduate," "complete undergraduate" and "postgraduate." I want to calculate the effect of a discrete change in education from "non-educated" to one of those categories. To do so, I basically need to force the other dummy variables I am not interested in to equal zero.

    Does anybody know how I can do that? Please let me know if that needs clearing up.

    Thanks!

  2. #2
    RoboStataRaptor
    Points: 7,341, Level: 56
    Level completed: 96%, Points required for next Level: 9
    bukharin's Avatar
    Location
    Sydney, Australia
    Posts
    1,018
    Thanks
    9
    Thanked 241 Times in 234 Posts

    Re: Calculating discrete changes

    Usually -margins- is the best way of doing this. You don't need to force the other dummies to be zero, although you can if that's desirable.

    Here is a simple example based on the first example from -help logit-:
    Code: 
    * example dataset - low birth weight
    webuse lbw
    
    * logistic regression of low birth weight; predictors are age (continuous), race (categorical)
    * and smoking during pregnancy (binary)
    logistic low age i.race smoke
    
    * what is the predicted probability of low birth weight (adjusted for age and smoking)
    * in each racial group?
    margins race
    
    * what is the average marginal effect of races 2 and 3 vs 1?
    margins, dydx(race)
    
    * what about in smokers vs non-smokers?
    margins race, at(smoke=(0 1))
    
    * example of a more complicated model with an interaction between age and race
    logistic low c.age##i.race smoke
    
    * to understand the interaction it's usually easiest to graph it
    levelsof age, local(ages)
    margins race, at(age=(`ages'))
    marginsplot, noci

  3. The Following User Says Thank You to bukharin For This Useful Post:

    Salohcin (08-15-2012)

  4. #3
    Points: 2,427, Level: 29
    Level completed: 85%, Points required for next Level: 23

    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Calculating discrete changes

    Thanks so much! I will look into it. I am still a bit unsure how I can force the other dummies to be zero. Would it be something like margins race, at(smoke = (0))? I am a bit confused about the syntax and I want to force multiple dummies to zero at once. Thanks a gain,

    Nick

  5. #4
    RoboStataRaptor
    Points: 7,341, Level: 56
    Level completed: 96%, Points required for next Level: 9
    bukharin's Avatar
    Location
    Sydney, Australia
    Posts
    1,018
    Thanks
    9
    Thanked 241 Times in 234 Posts

    Re: Calculating discrete changes

    Yes, although you don't need the internal set of parentheses - they're only needed if you're providing a list of numbers. So you can just do:
    margins race, at(smoke=0)

    ... or for something more interesting:
    margins race, at(smoke=0 age=30)

    ... or to demonstrate the use of a list:
    margins race, at(smoke=0 age=(20 30 40))

  6. The Following User Says Thank You to bukharin For This Useful Post:

    Salohcin (08-15-2012)

  7. #5
    Points: 2,427, Level: 29
    Level completed: 85%, Points required for next Level: 23

    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Calculating discrete changes


    That is 100% what I was looking for. I really appreciate that.

+ 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