Announcement

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

  • #16
    Thank you very much Clyde! Really useful advice.

    I was thinking that log-link implies ln(μ)=Xb, which is quite similar to a log-transformed dependent variable.

    Just by curiosity: the reason we could use -eyex- to derive the elasticity in case of GLM , but -dyex- in case of a model with log-dependent variable relates to error distribution?

    Many thanks again.

    Comment


    • #17
      Thank you Clyde! Really useful advice.

      Just by curiosity: In order to derive the elasticity, we use the -eyex- command in log-link GLM, and -dyex- in OLS with log-transformed dependent variable. Is this related to the error distribution?

      I think the log-link implies that log(E(y))=Xb, and thus y=e^(xb)+u, while the log-dependent OLS is given by y=e^(xb+u).

      Comment


      • #18
        Just by curiosity: the reason we could use -eyex- to derive the elasticity in case of GLM , but -dyex- in case of a model with log-dependent variable relates to error distribution?
        No. It relates to the fact that in a GLM the outcome variable is not log-transformed. A log-link is not the same thing as a log transformation of the outcome.

        With a log transformed variable you are saying:
        Code:
        E(log(y)) = Xb
        With a log-linked GLM you are saying
        Code:
        log(E(y)) = Xb
        Because log is a non-linear function, these are different things.

        In terms of the eyex() option in -margins-, it calculates (IV/DV)(dDV/dIV), which is the same as d(logDV)/d(logIV). If your dependent variable is already the log-transform of y, Stata has no way to know that and so eyex will calculate d(log log y)/d(log IV), which is not the elasticity of y, it is the elasticity of log y--which is not what you want. So, to avoid double-logging you have to use -dyex()- when the outcome variable is log transformed.

        When you use -margins- after a GLM, eyex() again calculates (IV/DV)(dDV/dIV). In calculating dDV/dIV, Stata knows about the link and incorporates that into its differentiation by the chain rule. But this time, the DV is y itself, not log y. So you end up with the correct value for d(log y)/d(log x).

        Comment


        • #19
          Thank you Clyde! Really useful interpretation!

          Comment


          • #20
            Dear All,

            just a quick question. In order to estimate the elasticity of a continuous variable from a logit model, is it fine to use -eyex-?


            Best regards,

            Nikos

            Comment


            • #21
              Yes, you use the -eyex()- option of -margins- for that. Do remember that in any non-linear model, such as -logit-, even if there are no interaction terms, the elasticity of a continuous variable is not constant. It changes with the variables itself. So if you just run
              Code:
              margins, eyex(continuous_var)
              you will get an "average" elasticity that obscures all the variation there. It is more informative to think of elasticity as a function of the continuous variable itself, choose an interesting range of values of the continuous variable, and obtain the elasticity at those various variables, and then present them in a table or graph. Thus:

              Code:
              margins, eyex(continuous_var) at(continuous_var = (interesting values))
              marginsplot

              Comment


              • #22
                Thank you!

                Comment


                • #23
                  I'm glad to have found this thread, because I had some similar questions. I don't know where I read that you also use -dyex- if your DV is a proportion (I want to say it was the Stata UCLA webpage). Is this correct? I'm using a logit-link (fractional proportion model), but the DV is a proportion.

                  So,in reality, the crucial difference is that -dyex- is for a log transformed variable, but if using a logit-link, where it's not log transformed, then -eyex- should be used for the margins command? Did I read through this thread correctly (particularly with RE at #18)?

                  Comment


                  • #24
                    I wonder what you're referring to here. There are no blanket rules that you calculate semi-elasticities with this kind of variable and elasticities with some other kind of variable so far as I know (except that both are applicable only to variables that take on exclusively positive values.) They are different things, and which one you use depends on which one answers your research question. Different questions call for different answers.

                    Comment


                    • #25
                      Originally posted by Clyde Schechter View Post
                      I wonder what you're referring to here. There are no blanket rules that you calculate semi-elasticities with this kind of variable and elasticities with some other kind of variable so far as I know (except that both are applicable only to variables that take on exclusively positive values.) They are different things, and which one you use depends on which one answers your research question. Different questions call for different answers.
                      I was just as confused when I read the use of -dyex- for a kind of variable believe me...

                      But, most importantly, I was trying to unpack your RE:
                      Just by curiosity: the reason we could use -eyex- to derive the elasticity in case of GLM , but -dyex- in case of a model with log-dependent variable relates to error distribution?
                      No. It relates to the fact that in a GLM the outcome variable is not log-transformed. A log-link is not the same thing as a log transformation of the outcome.

                      With a log transformed variable you are saying:
                      Code:
                      E(log(y)) = Xb
                      With a log-linked GLM you are saying
                      Code:
                      log(E(y)) = Xb
                      Because log is a non-linear function, these are different things.

                      In terms of the eyex() option in -margins-, it calculates (IV/DV)(dDV/dIV), which is the same as d(logDV)/d(logIV). If your dependent variable is already the log-transform of y, Stata has no way to know that and so eyex will calculate d(log log y)/d(log IV), which is not the elasticity of y, it is the elasticity of log y--which is not what you want. So, to avoid double-logging you have to use -dyex()- when the outcome variable is log transformed.

                      When you use -margins- after a GLM, eyex() again calculates (IV/DV)(dDV/dIV). In calculating dDV/dIV, Stata knows about the link and incorporates that into its differentiation by the chain rule. But this time, the DV is y itself, not log y. So you end up with the correct value for d(log y)/d(log x).
                      I think my wording was incorrect. You use eyex for with a log link, because the DV is not log-transformed? I'm sorry. I've actually been confused with dyex and eyex. I know you mentioned what the stata manual says:
                      Code:
                      dyex(varlist) estimate semielasticity—d(y)/d(lnx)
                      eyex(varlist) estimate elasticities of variables in varlist
                      I just want to see if I'm understanding this thread correctly. (Also, I think my mind confused log-link with *logit*-link).

                      Comment


                      • #26
                        You use eyex for with a log link, because the DV is not log-transformed?
                        If you preface that sentence with "to get the elasticity of the dependent variable," that is correct.

                        Comment


                        • #27
                          Originally posted by Clyde Schechter View Post
                          If you preface that sentence with "to get the elasticity of the dependent variable," that is correct.
                          Got it, Clyde. Thanks as usual. And English...she can be unforgiving. In all seriousness, thanks for all the replies on this thread. They have been very helpful.

                          Comment

                          Working...
                          X