Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Margins after reg to calculate probability of specific range of the dependent variable

    Dear all,

    I would like to use the margins command after a linear regression to predict the probability of the dependent variable falling into a specific range when certain covariates are set to specific values. I have tried to figure out whether this is possible using the manual and previous entries at Statalist, but was unfortunately unable to find a solution.

    An example with the automobile dataset would be to after regressing length on foreign, have margins calculate the predicted probability of the length being 180 or more when the car is foreign.

    One simple solution to the problem would of course be to dichotomise the dependent variable and run a logistic regression (code below for convenience), but in my particular case it would be a lot more elegant not to report an additional model.

    Code:
    sysuse auto
    recode length (0/179=0) (nonm=1), gen(length_binary)
    logit length_binary foreign
    margins, at(foreign=1)
    Is this possible using margins? Any help would be greatly appreciated!
Working...
X