Announcement

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

  • Problem in plotting interatcion term after fractional logit regression

    Hi, Everyone:

    I have two questions need your help.

    (1) I use fractional logit regression and have an interaction term. May I know how to plot the interaction term after running the fractional logit model by STATA?
    because it always shows: factor variables may not contain noninteger values, when I use "margins" command.

    (2) Previously, I use excel to plot the interaction term by using mean value adding and subtracting one standard deviation to represent the high and low-level moderator.
    My regression formula is Y=a+bx+cm+dx*m where the coefficient for margin effects on b is 0.003, c is 0.077, and d is -0.002,
    the mean value of independent variable(b) is 6.04, s.d=8.62, the mean value of moderator(m) is 0.56, s.d=6.25.
    the problem is when I use excel to plot interaction term, it generates negative Y value. However, my Y value should be range from 0 to 1,
    may I know what happened in my model and how do I solve this problem?

    Very thanks for your help.






  • #2
    Show the fracreg and margins commands you entered. My guess is that you are not using factor variable notation right, but without actually seeing the commands I can't say.

    Also, I like using the user-written mcp command for the type of plotting I think you want to see. For an overview, see

    https://www3.nd.edu/~rwilliam/stats3/Margins03.pdf

    This code with fragreg works fine.

    Code:
     webuse 401k, clear
    fracreg probit prate mrate c.ltotemp##c.ltotemp c.age##c.age i.sole
    margins sole
    mcp ltotemp sole, var1(20)
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Dear Williams:
      Thank you so much, and I list my command in the below
      fracreg logit eacountdivttlcitation_add0 roapasup_1 rever_roapasfall_1 wcpsales_1 rever_roafallwcpnew_1 logfirm
      > age_1 logsales_1 zscore_1 inventratio_1 der_1 perrd_div100_1 patcount_add0_1 instiowner_1 ipc0_fhhi1_1 fselfr
      > ate0_1 bselfrate0_1 indsample_1 indhhi_1 log_indsalesgrowth_1 if year>=1998 & year<=2012, nolog


      Fractional logistic regression Number of obs = 2,436
      Wald chi2(18) = 774.98
      Prob > chi2 = 0.0000
      Log pseudolikelihood = -1065.0537 Pseudo R2 = 0.2982

      --------------------------------------------------------------------------------------------
      | Robust
      eacountdivttlcitation_add0 | Coef. Std. Err. z P>|z| [95% Conf. Interval]
      ---------------------------+----------------------------------------------------------------
      roapasup_1 | -.0252506 .0143891 -1.75 0.079 -.0534528 .0029516
      rever_roapasfall_1 | .0146206 .0071983 2.03 0.042 .0005122 .028729
      wcpsales_1 | .5758466 .171755 3.35 0.001 .239213 .9124803
      rever_roafallwcpnew_1 | -.012656 .0039248 -3.22 0.001 -.0203484 -.0049636
      logfirmage_1 | -.820365 .2143916 -3.83 0.000 -1.240565 -.4001652
      logsales_1 | 1.579781 .108204 14.60 0.000 1.367705 1.791857
      zscore_1 | .0032741 .0089834 0.36 0.716 -.014333 .0208812
      inventratio_1 | -.412029 .664924 -0.62 0.535 -1.715256 .8911981
      der_1 | -.0047975 .0013124 -3.66 0.000 -.0073696 -.0022253
      perrd_div100_1 | .0637623 .0128751 4.95 0.000 .0385276 .0889969
      patcount_add0_1 | -.004918 .0006848 -7.18 0.000 -.0062601 -.0035759
      instiowner_1 | -.0115741 .0027754 -4.17 0.000 -.0170139 -.0061344
      ipc0_fhhi1_1 | 2.49512 .1854303 13.46 0.000 2.131684 2.858557
      fselfrate0_1 | 2.080399 .2203042 9.44 0.000 1.64861 2.512187
      bselfrate0_1 | .8095915 .7241519 1.12 0.264 -.6097201 2.228903
      indsample_1 | -.0075336 .003381 -2.23 0.026 -.0141602 -.0009069
      indhhi_1 | .0027345 .0079212 0.35 0.730 -.0127907 .0182597
      log_indsalesgrowth_1 | .234604 .1180456 1.99 0.047 .0032389 .4659691
      _cons | -10.93776 .7752999 -14.11 0.000 -12.45732 -9.418197
      --------------------------------------------------------------------------------------------

      margins rever_roapasfall_1#wcpsales_1
      rever_roapasfall_1: factor variables may not contain noninteger values
      r(452);

      I will quicly try your suggesitons.
      Very thanks for your help.




      Comment


      • #4
        Hi Lydia. First off, your code and output would be much easier to read if you used code tags. See pt 12 of the FAQ.

        Second, as I suspected, you aren't using factor variable notation. You may have even computed dummies yourself, which is another no-no if you are going to use margins. Or, the two variables you are trying to use in the margins command really are continuous, in which case it is not legitimate for them to appear to the left of the comma.

        Why don't you take a look at

        https://www3.nd.edu/~rwilliam/stats3/Margins01.pdf

        If you like that, you may want to check out the other margins handouts at https://www3.nd.edu/~rwilliam/stats3/index.html

        If it is still unclear to you what you are doing wrong, write back.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        StataNow Version: 19.5 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment


        • #5
          Dear Williams:
          Thanks for your great material and I have read it and also install mcp commands.
          However, I still have problems to plot "interaction" term, would you mind if I can send
          my data and my commands to your email and request your assistance?
          Best Regards
          Lydia

          Comment

          Working...
          X