Announcement

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

  • Question for result intepretation following Marginal Effect in Ordered probit

    Dear colleagues,

    I'm currently working on an ordered probit model. This model aims to measure the influence of several explanatory variables on the frequency of consumption of FAPs, which are divided into three classes.

    My first command is as follows:

    Code:
     oprobit frq_conso age genre enfant deplittoral revenumid revenusup prix_crit_dom obj pref_mode_prod pref_methode_prod pref_frais pref_env_sauv pref_env_elev pref_france pref_sanit sante faccuisin tasty expens [pweight=weight]
    After that, to obtain my marginal effect, i use :

    Code:
    mfx, predict (outcome(1))
    mfx, predict (outcome(2))
    mfx, predict (outcome(3))
    For exemple, i obtaine the following results for my outcome 1:

    Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	89.9 KB
ID:	1763010


    To interpret the result, can we say that consumers who perceived FAPs as expensive (last variable of the table) have a 6.9% increased probability of being in the Outcome 1 category?

    Thanks again for your help, and i remain available if youy needed more information!

    Best regards,

    Jean-François DEWALS

  • #2
    That is generally correct, but you can be more precise by indicating whether expens is continuous or categorical. That said, mfx has been superceded by margins. If you haven't before, I'd strongly suggest you read Richard Williams incredibly helpful course notes on using margins and other commands after ologit to get useful quantities of interest.

    Comment


    • #3
      About the only time you would use mfx is if you are condemned to using some horribly antiquated version of Stata, e.g. version 9. Even then, I would probably download and use the user written commands mfx2 and margeff. But if you've got Stata 11 or higher, use margins and/or the user-written commands in spost13.
      -------------------------------------------
      Richard Williams
      Professor Emeritus of Sociology
      University of Notre Dame
      StataNow Version: 19.5 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://academicweb.nd.edu/~rwilliam/

      Comment


      • #4
        Originally posted by Richard Williams View Post
        About the only time you would use mfx is if you are condemned to using some horribly antiquated version of Stata, e.g. version 9. Even then, I would probably download and use the user written commands mfx2 and margeff. But if you've got Stata 11 or higher, use margins and/or the user-written commands in spost13.
        Hallo, Richard. I have question regarding this margins command;

        I use Stata 14, has a categorical dependent var, dummy independent var, and some dummy for control vars. I use gologit2 as my ologit didnt fulfilled the parallel trend assumption. For interpreting the gologit2 result, it is better using marginal effect. I had read your notes about margins01, and here's my questions:

        The old mfx for obtaining marginal will give us the y value (in the figure above, what i mean is the 0.2144598). But, we also get the specified marginal effect value for each variables. Even if we run the marginal effect at representative value, it will also show the marginal value of each control vars (in the figure above, it is the; age = -0.0018664, genre = 0.005402, enfant* = 0.0011397, etc).

        But, when i use the margins command (as exemplified in the handout), like:

        Code:
        margins, dydx(CarOwnership) at(Female=0 EducCat=1) vsquish
        Note: CarOwnership=1 for Car's owner, Female=0 for male, and EducCat=1 for their latest education is junior high school

        The result is only the marginal value for jhs graduated male Car's Owner, but we did not get each of the marginal value for Female and EducCat variables.

        Click image for larger version

Name:	Screenshot 2026-01-30 at 22.38.15.png
Views:	1
Size:	555.9 KB
ID:	1784591


        Can we get the similar result when we obtain the marginal effect using mfx but we use the margins command?

        Comment


        • #5
          What -margins, dydx(CarOwnership) at(Female=0 EducCat=1) vsquish- gives you is the marginal effect of CarOwnership when both Female = 0 and EducCat = 1. It seems what you want is different: a marginal effect for Female = 0 (with no condition on EducCat) and one for EducCat = 1 with no condition on Female. For that, the code is different:

          Code:
          margins, dydx(CarOwnership) at(Female=0) at(EducCat=1) vsquish

          Comment


          • #6
            Dear Prof Schechter,

            Thank you very much for your reply. My question arise after i read about marginal effect from Long & Freese (2014) book about Regression Models for Categorical Dependent Variables using Stata. In the page 213, they show this: (yes, they still use that mfx command and for Stata 11 or higher, we already got the updated version using 'margins' command)

            Click image for larger version

Name:	WhatsApp Image 2026-01-31 at 12.45.52 AM.jpeg
Views:	1
Size:	133.8 KB
ID:	1784595


            For that result (value on marginal effects for y), do we interpret it like this? "the marginal effect of female in 1988 for outcome #1 is 0.06099996"

            How about the dydx value on the table? How do we interpret that (-0.0378526) for yr89 variable, 0.0581355 for male variable, etc? It is noted under the table that (*) dy/dx is for discrete change of dummy variable from 0 to 1 as they assigned specified value for yr89 and male on the command, while the others that they didnt assign, stata treat them at means. So, while we got the marginal value of female in 1988 for outcome #1, we also get the discrete change value for each variables?

            Because, when we use the 'margin' command, we will only get the y value of female in 1988 by 0.06099996, without those (-0.0378526) for yr89 variable, 0.0581355 for male variable, etc, is it right?

            Can we also get those specified discrete change value for each variables using 'margin' command?


            Thank you very much

            Comment


            • #7
              I never used the -mfx- command, even before -margins- was available. And I'm afraid I have never read Long & Freese's book, nor do I have access to a copy. So, I cannot answer most of the questions you raise in #6.

              For that result (value on marginal effects for y), do we interpret it like this? "the marginal effect of female in 1988 for outcome #1 is 0.06099996"
              The content you show in #6 makes no mention of female, 1988, nor 0.6099996. So I can't comment on this question.

              How about the dydx value on the table? How do we interpret that (-0.0378526) for yr89 variable, 0.0581355 for male variable, etc?
              As that is -mfx- output, I cannot really say. But if this were -margins- output, the interpretation would be that the probability of outcome 1 is 3.78...%pts lower in year 89 than in whatever year(s) is(are) represented by yr89 == 0. This calculation also assumes that all of the other variables, except male, in the model follow their distribution in the entire sample (regardless of the value of yr89 in the individual observations). The calculation treats the entire sample as if it were all male == 1. Similarly, the predicted probability of outcome 1 is 5.81...%pts higher for males than females, with all other variables following their distributions in the entire sample, regardless of which year, but with the entire sample treated as if it were all yr89 == 1.

              [quote]It is noted under the table that (*) dy/dx is for discrete change of dummy variable from 0 to 1 as they assigned specified value for yr89 and male on the command, while the others that they didnt assign, stata treat them at means. [quote]
              Again, I cannot speak for what -mfx- does, but if this were the output of -margins, then no, Stata does not hold the other variables at their means. You can ask Stata to do that with the -atmeans- option of -margins-, but the command shown does not do that. the command shown treats all the variables except male and yr89 as having their distributions exactly as in the data for the entire sample
              .
              So, while we got the marginal value of female in 1988 for outcome #1...
              I don't see anything about the marginal value of female in 1988 for outcome #1 in what you showed. However, since female and male are opposite categories of a dichotomy, we can infer that the marginal effect (not value) of female would be the same as that of male, but with the opposite sign.

              As for the matter of discrete changes, again -mfx- may be different and I don't know. But Stata's -margins- command always uses the discrete change when you ask for marginal effects of indicator ("dummy") variables. You cannot get the discrete change result for continuous variables from -margins-, and, frankly, I don't even think the concept of discrete change as applied to continuous variables makes any sense. In a linear regression, the discrete change would be the same as the marginal effect that -margins- calculates. And for non-linear models, the "discrete change" of a continuous variable would differ for each value of the continuous variable, so the whole concept is ill-defined as applied to them.


              Comment


              • #8
                Originally posted by Valerie Aulia View Post
                using margins command?
                The first edition of Long and Freese's book was published in 2001, so if your screenshot is from the 2014 edition, it is not clear whether they update the commands in the book from one edition to the next. As a public service, you might consider emailing them and suggesting they do this in their next update.

                What you show in #6 is just a standard calculation for marginal effects in an ordered logit model. The marginal change in the probability of outcome \(m\) with respect to regressor \(x_k\) is given by

                \[
                \frac{\partial \Pr(y = m \mid x)}{\partial x_k}
                =
                \frac{\partial F(\tau_m - x \beta)}{\partial x_k}
                -
                \frac{\partial F(\tau_{m-1} - x \beta)}{\partial x_k},
                \]
                where \(F(\cdot)\) denotes the cumulative distribution function of the error term and \(\tau_m\) and \(\tau_{m-1}\) are the cut points. This expression represents the slope of the curve relating \(x_k\) to \(\Pr(y = m \mid x)\), holding all other variables constant. In the example you show, we can consider the marginal effect of age,
                \[
                \frac{\partial \Pr(y = 1 \mid x)}{\partial \text{age}},
                \]
                evaluated for women in 1989, with all other covariates set to their sample means. This is equal to 0.001241. Calculating this using margins is straightforward.

                Code:
                use "https://academicweb.nd.edu/~rwilliam/gologit2/ordwarm2.dta", clear
                ologit warm yr89 male white age ed prst
                mfx compute, at(male=0 yr89=1) predict(outcome(1))
                
                *MARGINS REQUIRES EXPLICIT SPECIFICATION OF FACTOR VARIABLES
                ologit warm i.(yr89 male white) age ed prst
                margins, at(male=0 yr89=1) dydx(*) predict(outcome(1)) atmeans
                Res.:

                Code:
                . mfx compute, at(male=0 yr89=1) predict(outcome(1))
                
                warning: no value assigned in at() for variables white age ed prst;
                   means used for white age ed prst
                
                Marginal effects after ologit
                      y  = Pr(warm==1) (predict, outcome(1))
                         =  .06099996
                ------------------------------------------------------------------------------
                variable |      dy/dx    Std. err.     z    P>|z|  [    95% C.I.   ]      X
                ---------+--------------------------------------------------------------------
                    yr89*|  -.0378526      .00601   -6.30   0.000  -.049633 -.026072         1
                    male*|   .0581355      .00731    7.95   0.000   .043803  .072468         0
                   white*|   .0197511       .0055    3.59   0.000   .008972   .03053   .876581
                     age |    .001241      .00016    7.69   0.000   .000925  .001557   44.9355
                      ed |  -.0038476      .00097   -3.96   0.000  -.005754 -.001941   12.2181
                    prst |  -.0003478      .00019   -1.83   0.068  -.000721  .000025   39.5853
                ------------------------------------------------------------------------------
                (*) dy/dx is for discrete change of dummy variable from 0 to 1
                
                . 
                . 
                . 
                . *MARGINS REQUIRES EXPLICIT SPECIFICATION OF FACTOR VARIABLES
                . 
                . margins, at(male=0 yr89=1) dydx(*) predict(outcome(1)) atmeans
                
                Conditional marginal effects                             Number of obs = 2,293
                Model VCE: OIM
                
                Expression: Pr(warm==1), predict(outcome(1))
                dy/dx wrt:  1.yr89 1.male 1.white age ed prst
                At: yr89    =        1
                    male    =        0
                    0.white = .1234191 (mean)
                    1.white = .8765809 (mean)
                    age     = 44.93546 (mean)
                    ed      = 12.21805 (mean)
                    prst    = 39.58526 (mean)
                
                ------------------------------------------------------------------------------
                             |            Delta-method
                             |      dy/dx   std. err.      z    P>|z|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                        yr89 |
                       1989  |  -.0378526   .0060105    -6.30   0.000    -.0496329   -.0260723
                             |
                        male |
                        Men  |   .0581355   .0073129     7.95   0.000     .0438026    .0724685
                             |
                       white |
                      White  |   .0197511   .0054996     3.59   0.000     .0089721    .0305301
                         age |    .001241   .0001614     7.69   0.000     .0009247    .0015573
                          ed |  -.0038476   .0009726    -3.96   0.000    -.0057539   -.0019413
                        prst |  -.0003478   .0001903    -1.83   0.068    -.0007208    .0000251
                ------------------------------------------------------------------------------
                Note: dy/dx for factor levels is the discrete change from the base level.
                
                .

                Comment


                • #9
                  Dear Clyde Schecter and Andrew Musau,

                  Thank you very much for the replies! This really help me on understanding this mfx and marginal effect 🤗 I've tried the command using

                  Code:
                   
                   margins, at(male=0 yr89=1) dydx(*) predict(outcome(1)) atmeans
                  and get the result that I'm expecting😁

                  Thank youuu

                  Comment

                  Working...
                  X