Announcement

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

  • Error issued when using "margins" after xtoprobit

    Dear All.

    The relevant codes are as follows:
    xtset pnrt aar
    xtoprobit depvar varlist, nolog
    margins, dydx(*)


    Regularly after probit/logit functions you can use the postestimation command "Margins" to get PEA and APE. But when i use it after xtoprobit i get the error "option pr not allowed". From the function description of xtoprobit it should be able to execute this command. Do anyone have an idea as to why I get this error?
    Last edited by Dennis Hongaard; 07 Apr 2016, 06:27.

  • #2
    There is nothing obviously wrong with your code. A similar example runs perfectly fine on my setup. I wonder if there are details that you haven't shown us. I would suggest re-posting with the actual commands and the complete Stata output from your real situation. To assure that what you show is exactly what happened, do it by copying from Stata's Results window or your log file to your computer's clipboard and then pasting into a code block here on the Forum. (If you are not familiar with setting up a code block, see FAQ #12, 7th paragraph for instructions.)

    Comment


    • #3
      Also indicate what version of Stata you are using. I have a feeling Stata changed some of the default margins options in Stata 14. You may have to include the predict option on your margins command.
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      Stata Version: 17.0 MP (2 processor)

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

      Comment


      • #4
        To follow up, the predict(pr) option is NOT allowed in Stata 13 but is the default for 14. But in the code above you don't ask for that. Like Clyde, I am guessing that you are leaving some things out. Show the exact code and output and also indicate the version of Stata that is being used.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        Stata Version: 17.0 MP (2 processor)

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

        Comment


        • #5
          Thank you both for your inputs. As you suggest I'm new to this forum and are still learning the language.

          I'm using version 14.0 and my explicit code is as follows:

          Code:
          xtset pnrt aar
          gen linkf15    = log(inkf15)
          gen linkm15   = log(inkm15)
          gen udd = i_udd
          replace udd = f_udd if f_udd<i_udd
          
          xtologit udd uddf15 uddm15 linkf15 linkm15, nolog
          estpost margins, dydx(*) atmean quietly
          estimate store ologit_PEA
          quietly xtologit udd uddf15 uddm15 linkf15 linkm15
          estpost margins, dydx(*)      
          estimate store ologit_APE
          
          xtoprobit udd uddf15 uddm15 linkf15 linkm15, nolog
          estpost margins, dydx(*) atmean quietly 
          estimate store oprobit_PEA
          quietly xtoprobit udd uddf15 uddm15 linkf15 linkm15 if aldert>30, nolog
          estpost margins, dydx(*) quietly
          estimate store oprobit_APE
          
          esttab /*ologit_PEA*/ ologit_APE /*oprobit_PEA*/ oprobit_APE
          This is my full code except for some renaming and loading. I have a similar one limiting on cross-section where i use oprobit/ologit and it doesn't give an error. The udd* variables are all discrete ranked variables, whereas the link* are simply log(income) variables.
          I have tried just to run the margins code without the estpost, but it doens't help.

          Comment


          • #6
            First off you should have Stata 14.1, not Stata 14. Run -update all- to make sure you have the most current Stata.

            Second, margins has a post option, so I would use it rather than estpost.

            If problems persist, show us both code and output up to the point where the error occurs.
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            Stata Version: 17.0 MP (2 processor)

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

            Comment


            • #7
              Thank you very much Richard, this fixed the problem. I actually thought Stata ran updates automatically during startup, but it seems as if it only "looks for" new updates.

              I believe updating was the solution as both
              Code:
              margins, dydx(*) post
              and
              Code:
              estpost margins, dydx(*)
              are now working.

              Comment

              Working...
              X