Announcement

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

  • Margins and MCP commands produce the different results.

    I am trying to calculate predicted values but the margins command and mcp command produce the different values. For example, according to the margins command, when control=1, the predicted value is 0.0035953 but according to the mcp graph, it is over 0.04. Also, when control=6, the margins command produces 0.0075143 while the mcp graph indicates over 0.008.

    I used the following commands.

    margins, at ( control = (1 (1) 6)) atmeans expression(invlogit(predict(xb)))
    mcp control , margopts(expression(invlogit(predict(xb))))

    Could anyone explain what is going on? Thank you!
    Click image for larger version

Name:	MCP.png
Views:	1
Size:	43.0 KB
ID:	1730085

    Click image for larger version

Name:	Margins.png
Views:	1
Size:	17.6 KB
ID:	1730084

    Last edited by April Kimm; 13 Oct 2023, 00:22.

  • #2
    marginscontplot is from the Stata Journal, as you are asked to explain in FAQ Advice #12.

    Margins and MCP commands produce the different results
    That cannot be correct because mcp calls on margins to do the calculations. To see the equivalent margins command, use the option -showmarginscmd-

    Code:
    mcp control , margopts(expression(invlogit(predict(xb)))) showmarginscmd

    Comment


    • #3
      What is the estimation command before margins?

      mcp does not default to atmeans. Drop it from the margins command and see what happens.
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      StataNow Version: 19.5 MP (2 processor)

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

      Comment

      Working...
      X