Announcement

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

  • logit model - curvilinear model (inverted U shape) and calculation of the peak point using stata

    Hello everyone,
    I have a question regarding calculating the peak point of the inverted U-shaped relationship.

    I am running a logit model and am asking this question because the margins plot does not seem to reflect the peak point I calculated using the coefficients of the plain term and the quadratic term.

    I ran a logit model,
    logit dv c.iv##c.iv controls
    margins, at (iv = (0(0.1)1))
    margins plot


    The coefficient for the plain term of my iv is 1.229, and the coefficient for the quadratic term of my iv is -0.996.
    So I calculated that the peak point should be -1.229/(-0.996 * 2) = 0.617.

    However, the peak point shown in the margins plot is very much around 0.2 ish.

    Did I do something wrong? - if so what are the possibilities of things that went wrong?

    Thank you so much!



  • #2
    The margins you specified will return predicted probability, but you computation was based on linear prediction in logit. So, in the margins command, you'll need to add an option "predict(xb)" to change the output. For more information, use "help margins" and look under "Options", pay attention to "predict(pred_opt)".

    Comment


    • #3
      -margins- is not plotting the quadratic function that evaluates to the logarithm of the odds of your dv. -margins- calculates the modeled probability of your outcome conditional on the values of iv that you specified and marginalized over the other variables in the regression model and then calculates that. The invlogit transform that gets you from log odds to probability already changes the shape of things, though being a monotone increasing function it does not, itself, change the location of the maximum. But then, the -margins- results are averaged over the distribution of the covariates ("controls") in your model, which moves things around from the simple quadratic function in your regression equation in unpredictable ways.

      The short version is that -margins- is plotting averages of predicted probabilities at the given values of iv, and those predicted probabilities depends on the covariates in addition to the quadratic function of iv. It apparently turns out that values of iv near 0.2 are associated with covariate values that boost the predicted probability of dv more than the quadratic function of iv does when iv is near 0.6.

      So nothing went wrong. Your calculation for the vertex of the quadratic function relating iv to log odds dv is correct. But there are several steps from there to the -marginsplot- output that change things radically.

      Added: Crossed with #2.
      Last edited by Clyde Schechter; 31 Jul 2023, 11:08.

      Comment

      Working...
      X