Announcement

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

  • mcp error "There was a problem executing -margins-."

    Dear colleagues, my first post here so apologies if I'm doing it wrong.

    I always use Royston's mcp (marginscontplot) command to produce my graphs.

    But this time I get the following error:

    Code:
    There was a problem executing -margins-.
    The command issued was essentially as follows:
    margins , at( cp_predict2=( 0 2 4 6 8 10 12 14 16 18 20) director_totco=( 1 4))
    r(322);
    What I ran was the following:
    Code:
    xtlogit f.newODdum cp_predict2 independent_num total_news_cpceo politcon roa_w pb_2y_w lnTobQ1_w ceo_age ceo_tenure duality director_totco c.cp_predict2#c.independent_num c.cp_predict2#c.ceo_tenure c.cp_predict2#c.director_totco i.year, fe
    Followed by:
    Code:
    mcp cp_predict2 director_totco, at1(0(2)20) at2(1 4) plotopts(scheme(sj))
    FWIW, I pick those values because that is the meaningful range of x (at1) and -1/+1 SD for the moderator. But it doesn't matter what values I enter for at1/var1 at2; Stata returns (some variation of) the error reported at the top of the post. But normally mcp works fine for me. Scouring the internet did not help and the r322 error just says "something went wrong". Duh.

    Any ideas? I'm sure I'm overlooking something obvious.
    Thanks in advance.

  • #2
    It tells you what margins command it tried to execute. What happens if you copy that command and run it directly? Hopefully you would get a more informative error message.

    You may also want to look at this thread, which explains why margins after fixed effects is problematic.

    https://www.statalist.org/forums/for...-after-xtlogit

    Finally, remember mcp is basically a nice shell. You can enter the margins commands and plotting commands directly if you want, and that may make problems more obvious. It may be that the problem isn't really mcp, it may be that you are trying to do something that is problematic.
    -------------------------------------------
    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
      I appreciate the reply Richard. You're all over this forum and always Johnny-on-the-spot.

      If I do as you suggested, and just enter the "margins" command on its own followed by "marginsplot", I get the graph I'm looking for. Which is nice, but it seems odd.

      Thanks for reminding me there's an old-fashioned way to do things!

      Comment


      • #4
        I expected you to get clearer error messages, not results! Maybe there is a bug in mcp or maybe this is a limitation. I’ve never seen it used after an xt command before.

        You should still read the thread I suggested. You got results but they may be based on dubious assumptions.
        -------------------------------------------
        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
          Sorry I overlooked your last reply Richard. Sometimes mcp reacts that way, even when margins handles the request just fine. I don't know why it is. I've run it after xt dozens of times and gotten graphs that look like what I would expect them to. I wasn't expecting a clearer error message in this particular case either. I am not so clear on what may have been dubious about the assumptions. The error code itself was not very informative.

          Comment

          Working...
          X