Announcement

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

  • Plotting the Nonlinear Regression with Moderation Using xtdpdqml Quasi-Maximum Likelihood (QML)

    Hello Statalist,

    I'm using xtdpdqml for a quasi-maximum likelihood model to estimate a nonlinear relationship between "lc" and "zsc", with "pol_stab" moderating this relationship. The following stata code is used to run the regression:

    xtdpdqml zsc lc lc*lc lc*pol_stab lc*lc*pol_stab capi size dep roe costincome gdp gdpcap inf pol_stab y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11, fe vce(robust) nolog

    Could someone please advise on how to visualize this nonlinearity using xtdpdqml command? I've tried marginsplot but encountered issues with predicted values ("default prediction is a function of possibly stochastic quantities other than e(b)").


    Thank you for your assistance!

  • #2
    Hello,

    I'll be grateful if someone could provide assistance on this.

    Thank you!

    Comment


    • #3
      xtdpdqml does not support factor variables, and therefore also does not support margins and marginsplot.

      You would need to do things manually, knowing the formulas for the object you want to compute. That does not require too much work, given that the underlying model is linear. Here is an example that plots the marginal effect of a variable w on the outcome variable n, when w is also interacted with k:
      Code:
      webuse abdata
      gen wk = w*k
      xtdpdqml n w k wk, fe vce(robust) nolog
      gen dndw = _b[w] + _b[wk] * k
      sort k
      line dndw k
      (Note that in this case the marginal effect is a linear function in k, but not a constant.)
      https://www.kripfganz.de/stata/

      Comment

      Working...
      X