Announcement

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

  • Find corresponding X for a threshold of Y in estimated model

    Dear Statalist,

    I have estimated a model like this:

    elec= -12.83927*ldisp + .7345735*ldisp2 + (other variables)

    What I wanna do is to find the corresponding value of ldisp at a threshold level of elec, say elec=0.7 (this is not turning point). I could solve equation -12.83927*ldisp + .7345735*ldisp2 + average of all other variables=0.7 to find ldisp, but I would like to know whether any command in Stata can help.

    Thank you in advance!

  • #2
    Use the quadratic formula. If ax2 + bx + c = 0, then x =[ - b +/- sqrt(b2 - 4ac)]/2a.

    You can do the calculation with locals or scalars.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      Use the quadratic formula. If ax2 + bx + c = 0, then x =[ - b +/- sqrt(b2 - 4ac)]/2a.

      You can do the calculation with locals or scalars.
      Thanks Clyde, that's what I have done. Just curious whether any other way to do it quicker :D
      Clyde Schechter about parameter "c' in that formula, I simulate effects of all other variables at average level by parameter "c", do you think that is a appropriate way?
      Last edited by Leon Nguyen; 20 May 2019, 21:25.

      Comment


      • #4
        I simulate effects of all other variables at average level by parameter "c", do you think that is a appropriate way?
        I'm not sure exactly what you mean by that. The value of c in the equation should be the term representing the average contributions of all the other variables to the regression, and then subtract 0.7. I don't know in what sense you say you "simulate" that. I think the simplest way to calculate that is
        Code:
        margins, at(ldisp = 0) atmeans
        Note: The above code will only work correctly if you used factor variable notation in your original regression.

        Comment

        Working...
        X