Announcement

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

  • Elasticiticy of interaction between factor and continuous vars.

    Dear all.
    I have tried computing the elasticity of interaction variable between factor and continuous vars according the to the example given by Vince Wiggins
    HTML Code:
    http://www.stata.com/statalist/archive/2013-01/msg00293.html
    Stata (14.1) reports: "levels of interactions not allowed"
    This is the code I was trying (my data is a panel):
    Code:
    areg  lnprice  c.scoreNL  i.stars1 i.stars2 i.stars3 i.stars4 i.stars1#c.scoreNL i.stars2#c.scoreNL i.stars3#c.scoreNL i.stars4#c.scoreNL , absorb(city_code) vce(cluster city_code) , absorb(city_code) vce(cluster city_code)
    margins, dyex(stars1#c.scoreNL) at (stars1 ==1)
    I used -dydx- for elasticity since my dep. var. is transformed into ln.
    I don't know how else to compute the elasticities of my interaction terms.
    Anat


  • #2
    I think you should re-read Vince Wiggins' post more carefully. He never shows anything that looks like -margins, dyex(stars1#c.scoreNL) at (stars1 ==1)-, and the post actually begins with explaining why interaction terms do not have interaction terms in the ordinary sense of the word. That's because interaction terms are themselves already first derivatives (or first-differences in the discrete case), so the closest analogy would be a second derivative. More importantly, even if there were some quick and easy way to calculate those second derivatives (he does show a somewhat complicated way to approximate them), they don't mean the same thing as a marginal effect because in principle you cannot change a marginal effect by itself: you must change one or both of its main effects in order for that to happen.

    Comment


    • #3
      Thank you Clyde! it is complicated indeed.. in fact I know some scholars who just calc. the interaction term by using "g x1x2=x1*x2" and then run the -margins- on x1x2 which is basically wrong (yet it is published in top journals..).
      I was referring to the part in Vince Wiggins' post where he uses this code.
      Code:
      probit foreign turn i.dum i.dum#c.turn, nolog
      argins, dydx(*) atmeans at(dum=1)
      I could not use dxdy(*) since I have other factor variables
      I don't quite understand what do you mean by 2nd derivatives..as far as I understand all linear regression's coefficients are first derivatives, so when you say that: "interaction terms are themselves already first derivatives" what is the difference?

      Comment


      • #4
        Well, yes, it all depends on your starting point. You are right that the coefficients are themselves first derivatives. They are d(xb)/dx. Marginal effects, however, are d(outcome)/dx--which is rather different in a non-linear model such as probit. This is what I had in mind when I referred to marginal effects as first derivatives. The coefficients of interaction terms, though are not d(xb)/d(interaction) because there is no such thing as d(interaction). They are d2xb/dx1dx2, where x1 and x2 are the "main effects" of x1#x2. So if we calculated something analogous to a marginal effect for this, it would be some kind of third derivative.

        I don't understand what you mean by "I could not use dxdy(*) since I have other factor variables." You can add other factor variables to that model and still run that same -margins- command and get results.

        I know some scholars who just calc. the interaction term by using "g x1x2=x1*x2" and then run the -margins- on x1x2 which is basically wrong (yet it is published in top journals..).
        Those scholars are just demonstrating that they don't understand what interaction terms are. And the phenomenon demonstrates that peer review is fallible.

        Comment


        • #5
          I understand now.
          I don't understand what you mean by "I could not use dxdy(*) since I have other factor variables." You can add other factor variables to that model and still run that same -margins- command and get results.
          I meant that when I use dxdy(*) Stata states: factor variables not allowed in option dyex(), so I tried to isolate only the interaction term I need 'stars1#c.scoreNL' in the point were stars1==1, but then it returned " "levels of interactions not allowed". I think it will be best is to do it manually by d2xb/dx1dx2 which I still need to figure out how to do..and I totally agree with your last inference.. this is very sad.

          Comment


          • #6
            I think it will be best is to do it manually by d2xb/dx1dx2 which I still need to figure out how to do
            OK. But think carefully about what you are trying to calculate and what it means. I don't know the context of your analysis, but just applying common experience to the names of your variables, it is hard for me to think of what d2xb/dx1dx2 would correspond to in the real world. The closest I can come to is that you might want to calculate the marginal effect of stars1 at several different levels of scoreNL (which is easy to do with -margins, dydx(stars1) at(scoreNL = (interesting values of scoreNL)) atmeans-, and then graph those with -marginsplot-. Why the slope of that curve at any point or all points (which is what that second derivative represents) would be of any interest or have meaning in the problem eludes me. But then, as I say, I don't know your context, and perhaps it is quite meaningful.

            Comment


            • #7
              My context is very simple, I'm trying to demonstrate that online consumer reviews (continuous var) in websites like booking.com have the stronger effect on 1 stars hotel's demand (since quality uncertainty is high in this class) and the lowest effect on 5 stars hotels demand.. so I guess dydx(scoreNL) at(stars = (anyone of the 5 categories)) atmeans will show what I want..

              Comment


              • #8
                Yes, that makes sense to me.

                Comment


                • #9
                  Thanks!

                  Comment


                  • #10
                    Originally posted by Clyde Schechter View Post

                    OK. But think carefully about what you are trying to calculate and what it means. I don't know the context of your analysis, but just applying common experience to the names of your variables, it is hard for me to think of what d2xb/dx1dx2 would correspond to in the real world. The closest I can come to is that you might want to calculate the marginal effect of stars1 at several different levels of scoreNL (which is easy to do with -margins, dydx(stars1) at(scoreNL = (interesting values of scoreNL)) atmeans-, and then graph those with -marginsplot-. Why the slope of that curve at any point or all points (which is what that second derivative represents) would be of any interest or have meaning in the problem eludes me. But then, as I say, I don't know your context, and perhaps it is quite meaningful.
                    Dear Clyde
                    Should we run the regression with or without the interaction term before we do this -margins, dydx(stars1) at(scoreNL = (interesting values of scoreNL)) atmeans- ?

                    Comment


                    • #11
                      This thread was in the context of a model containing an interaction term. (See code block in #1.)

                      I note also that the model in question here was a linear model, so without an interaction term, there isn't even really anything to talk about: the marginal effect of any term would be constant, and given by its coefficient.

                      Comment

                      Working...
                      X