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

  • Estimating elasticity eyex command help


    I am relatively new on STATA, so I have some questions..I am trying to estimate a model based on a cross-section, in which the dependent variable Y is log-transformed, and the independent variable X is not. I would like to draw some conclusions about the elasticity of X. Should I use the 'eyex' command, or just to log the variable X in order to directly derive the elasticity? Generally, the most commonly applied method for deriving elasticities is the 'eyex' command?

    Lastly, I am trying to use the 'eyex' command after a two-part model, but the STATA mentions
    Warning: cannot perform check for estimable functions.
    A retransformation method must be specified.
    invalid syntax

    Could you please help me on this? How can I run the 'eyex' command after a two-part model?

    Thank you very much.


  • #2
    Since you don't show the actual command you gave, it's not possible to advise what, if anything, you are doing wrong here. -eyex- is not a command: it is an option in the -margins- command syntax. If you want specific advice about what is causing this error, you should post the regression command, Stata's response to that, and the -margins- command and Stata's response to that. Please do that by copy/pasting directly from Stata's Results window or your log file, and use code delimiters (see FAQ #12 for details on code delimiters) to encapsulate the pasted content so it will present in a readable way. Please don't edit in any way: little details may be crucial.

    That said, if you are looking for elasticity of Y with respect to X, and Y is already log transformed, but X is not, then I think what you need is not -eyex()-, but -dyex()-.


    • #3
      Besides Clydes' insightful advice, Nikos may wish to take a look at this Stata Tip on elasticities:

      Hopefully that helps.


      Best regards,



      • #4
        Thank you for your answers. They were really helpful. I thought that -dyex- gives semi-elasticities. Given that that y is log-transformed, do you think that -dyex- is preferable compared to -eyex-?

        The command for the two-part model is the following:

        twopm health_expenditure income male i.REG i.Household_size [pweight = HA10] , firstpart(logit) secondpart(regress, log)
        margins, eyex(income) atmeans


        • #5
          Carlo and others #3: Thanks for citing the Stata Journal tip by Kit Baum, but please use the definitive URL for such publications:

          1. That's the correct and only authoritative reference.

          2. It's also most likely to be the most durable.

          3. Other sources based on copying from SJ originals usually are unauthorised (even in the case of otherwise respected institutions) and don't deserve any publicity.

          I am an Editor of the Stata Journal and know whereof I speak.


          • #6
            Regarding #4, I'm not familiar with the -twopm- command, which is not part of official Stata. (You are asked to say where user-written Stata commands come from when posting.) In particular, I do not know if -twopm- itself does log-transformation of its dependent variable.

            In any case, the question is what your dependent variable already is and what you want the elasticity of. If your dependent variable is already the log-transform of the variable you want the elasticity of, then -eyex()- would be incorrect as it would be based on a double log, and -dyex- would be appropriate. If the variable you want the elasticity of is, in fact, the log itself and the dependent variable is that log, then -eyex()- is appropriate. If your dependent variable is not log transformed in the model and is the variable whose elasticity you want, then, again, it is -eyex()-. So you just need to be clear about what you want the elasticity of, and how it is represented in your model.


            • #7
              Carlo seems innocent (in this instance, at least)!
              Last edited by Carlo Lazzaro; 12 Jan 2017, 10:53.
              Kind regards,


              • #8
                Sorry, it was Marcos! (Marcos, Carlo; both exceedingly polite here, always; one reason I think of them together.)


                • #9
                  Thank you very much Clyde.
                  I have a model which is like: logy=a+bX1+cX2+error, and I want to estimate the elasticity of y with respect to X1. So I guess that -dyex- is the appropriate. However, I am not sure how this could be interpreted, meaning that -dyex- is normally semi-elasticity (i.e. percentage change in Y from a unit increase in X1). Elasticity is % change in Y from a 1% change in X1.

                  In this case, of the log-level model, how could I interpret the product of the -dyex- ?


                  • #10
                    Thanks, Nick: very flattering!
                    Kind regards,


                    • #11

                      The semi-elasticity of log y is exactly the same thing as the elasticity of y!


                      • #12
                        Nick Cox : sorry for citing an unauthorized version. Actually, I thought that one was also "official", so to speak. Thank you for showing how to tell one from the other! Also, thanks for the compliment: great to be somewhat taken in the same 'team' as Carlo's! Best, Marcos
                        Last edited by Marcos Almeida; 13 Jan 2017, 06:05.
                        Best regards,



                        • #13
                          Sometimes institutions have subscriptions to the SJ and put up versions of papers on some intranet intended for their own people. What they aren't authorised to do is make those files universally visible. I don't want to say more. But the main point is simple: the definitive reference for the Stata Journal is the Stata Journal, printed or website.


                          • #14
                            Thank you Clyde! Generally, could I use margins command and -eyex- to estimate the elasticity from a GLM?

                            Thank you.


                            • #15
                              Generally, could I use margins command and -eyex- to estimate the elasticity from a GLM?
                              Yes. In fact, that is one of the reasons to prefer using a GLM with a log link over log-transforming the outcome variable.