I'm considering a Probit model for the probability that a student will finish the course based on their hours of study, age, sex, origin, how they passed the previous course and labor market situation for students.

probit finish hours age women inmigrant previous_courses

Now with these estimates, I have to compute the number of hours of study necessary so that the probability of completing the course of a student who works is the same as that of another student with identical characteristics but who does not work.

I know I have to use the command margins but I can't figure out how. Any clue?

​​​​​​​Thanks in advance!

  • $\begingroup$ Your Stata code seems to be missing the labor market variable. $\endgroup$
    – dimitriy
    Jun 8, 2020 at 18:05

1 Answer 1


In a probit model,

$$\Pr(Y=1 \vert x,d,z)=\Phi(\alpha + \beta x + \gamma d + \eta z)$$

The probit index function coefficients that software usually reports are the ones inside the cumulative normal $\Phi()$ function. In a linear index function model, you just need to compare the ratio $\frac{\gamma}{\beta}$ to figure out the "exchange rate" of d and x that keeps the index function constant, leading to the probability being the same. More involved index function models (e.g, polynomials) require more subtle treatment.

In Stata, you can do this fairly simply. Below we will model the probability that an automobile is foreign using a binary variable for high MPG, weight, and headroom. The high MPG coefficient tells you the decrease in the index function when we go from low to high MPG. That decrease is $-1.211047$. The headroom coefficient is $-.0884369$, so we need $\frac{-1.211047}{-.0884369} \approx 13.7$ inch reduction to keep the index function constant. Once you know the decrease, you just need to alter the value of headroom variable accordingly and use margins to evaluate the new probability:

. sysuse auto, clear
(1978 Automobile Data)

. gen high_mpg = mpg>20

. probit foreign i.high_mpg c.headroom c.weight, nolog

Probit regression                               Number of obs     =         74
                                                LR chi2(3)        =      35.59
                                                Prob > chi2       =     0.0000
Log likelihood = -27.238263                     Pseudo R2         =     0.3952

     foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
  1.high_mpg |  -1.211047   .6997719    -1.73   0.084    -2.582575    .1604803
    headroom |  -.0884369   .2754295    -0.32   0.748    -.6282689    .4513951
      weight |  -.0022385   .0005811    -3.85   0.000    -.0033774   -.0010996
       _cons |   6.607414   2.009356     3.29   0.001     2.669148    10.54568

. local coef_ratio = _b[1.high_mpg]/_b[headroom]

. margins, at(high_mpg == 0) at(high_mpg == 1 headroom == generate(headroom - `coef_ratio'))

Predictive margins                              Number of obs     =         74
Model VCE    : OIM

Expression   : Pr(foreign), predict()

1._at        : high_mpg        =           0

2._at        : high_mpg        =           1
               headroom        = headroom - 13.69391819797684

             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
         _at |
          1  |   .4314792   .0635196     6.79   0.000      .306983    .5559753
          2  |   .4314792   .6014639     0.72   0.473    -.7473684    1.610327

The (1) _at reports average predicted probability as if every car had low MPG, but its own observed weight and headroom.

The (2) _at shows the average modeled probability as if every car had high MPG and less headroom to offset that, but its own weight. Note that this entails nonsensical, negative values of headroom since the max value is 5 and we are subtracting almost three times that from every observation. You may have similar violations, though perhaps that is exactly the point you hope to make with this model.

Obviously, any causal interpretations of this exercise depend on where the variation in the data comes from.


sysuse auto, clear
gen high_mpg = mpg>20
probit foreign i.high_mpg c.headroom c.weight, nolog
local coef_ratio = _b[1.high_mpg]/_b[headroom]
margins, at(high_mpg == 0) at(high_mpg == 1 headroom == generate(headroom - `coef_ratio'))

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.