Announcement

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

  • Spost13 problem

    I'm trying to use Spost13 package to perform logit regression analysis.
    But there is some problem.
    If I typed "mtable, atmeans stat(all)" there is no problem.
    But If I typed "mtable, atmeans pr(0 1) stat(all)" there is Error.

    Error is "Margin_0: operator invalid" r(198).

    Click image for larger version

Name:	Capture2.JPG
Views:	1
Size:	39.5 KB
ID:	1647077




    I typed "ado" and uninstalled Spost13 and Spost9 and I reinstalled Spost13. But the problem is repeated.
    Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	45.0 KB
ID:	1647078


    How can I solve this problem? I reinstalled STATA17 but the problem is not solved....









  • #2
    The following example duplicates your mtable syntax but does not encounter your error.
    Code:
    sysuse auto, clear
    logit foreign price weight
    mtable, atmeans pr(0 1) stat(all)
    Code:
    . sysuse auto, clear
    (1978 automobile data)
    
    . logit foreign price weight
    
    Iteration 0:   log likelihood =  -45.03321  
    Iteration 1:   log likelihood =  -22.92708  
    Iteration 2:   log likelihood = -18.834379  
    Iteration 3:   log likelihood = -17.996532  
    Iteration 4:   log likelihood = -17.976397  
    Iteration 5:   log likelihood = -17.976341  
    Iteration 6:   log likelihood = -17.976341  
    
    Logistic regression                                     Number of obs =     74
                                                            LR chi2(2)    =  54.11
                                                            Prob > chi2   = 0.0000
    Log likelihood = -17.976341                             Pseudo R2     = 0.6008
    
    ------------------------------------------------------------------------------
         foreign | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           price |   .0009296   .0002999     3.10   0.002     .0003418    .0015174
          weight |  -.0058785   .0016986    -3.46   0.001    -.0092078   -.0025493
           _cons |   9.000473   2.627577     3.43   0.001     3.850517    14.15043
    ------------------------------------------------------------------------------
    
    . mtable, atmeans pr(0 1) stat(all)
    
    Expression: Pr(foreign), predict(pr)
    
               | Domestic   Foreign
     ----------+-------------------
        Margin |    0.953     0.047
            se |    0.046     0.046
             z |   20.632     1.009
             p |    0.000     0.313
            ll |    0.863    -0.044
            ul |    1.044     0.137
    
    Specified values of covariates
    
               |    price    weight
     ----------+-------------------
       Current |     6165      3019
    
    
    . ado dir spost13_ado
    
    [19] package spost13_ado from https://jslsoc.sitehost.iu.edu/stata
          Distribution-date: 19Jul2020
    
    .
    But I must be honest. I tried about ten different versions of the mtable command and all of them encountered various errors regarding the pr() option. I am as certain as I can be that even your version initially encountered an error, but I now am no longer able to induce the error no matter what changes I make to the mtable command.

    At a minimum try the above example and see if get an error or not.
    Last edited by William Lisowski; 28 Jan 2022, 09:20.

    Comment


    • #3
      William's code worked fine for me the first time,

      Haseok may want to try his problem on a different machine, if possible. I wonder if his machine is corrupted somehow.

      Or, if he is allowed to share, use dataex to create a small extract of his data and share it as well as the code that will replicate the problem. Or, use publicly available data sets that will replicate the problem.

      As it is, I don't think we have enough information to see what is causing the issue.

      As a sidelight, the location for spost13_ado has changed. I actually had it listed twice in my list of downloaded files:
      Code:
      . ado dir spost13_ado
      
      [277] package spost13_ado from http://www.indiana.edu/~jslsoc/stata
            Distribution-date: 05Apr2019
      
      [353] package spost13_ado from https://jslsoc.sitehost.iu.edu/stata
            Distribution-date: 19Jul2020
      I'm not sure, if you download it from the old site, adoupate would still update it for you, or if pieces remaining from the original installation could cause problems. To be safe, I gave the command

      Code:
      . ado uninstall [277]
      
      package spost13_ado from http://www.indiana.edu/~jslsoc/stata
            Distribution-date: 05Apr2019
      
      (package uninstalled)
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      StataNow Version: 18.5 MP (2 processor)

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

      Comment

      Working...
      X