Announcement

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

  • Exporting table of results of prtest for Two-sample test of proportions using VARIABLES NOT GROUPS !

    hello, everyone!

    I cannot find a way to export the results of prtest of a two-sample test of proportions using variables. there is a topic answering this question, however, that is applicable only for the test with a group estimation, which does not work in my case.

    my version of stata is 14

    this is a command I used, but it didn't work

    >>> estpost prtest var1, by(var2)
    >>> esttab, cell("b se0 z p") nomtitle nonumber

    which I took from - http://repec.org/bocode/e/estout/est...tml#estpost106

    however, the estimates are totally different from

    >>> prtest var1==var2 (which i need)

    please help!

    thanks in advance!

  • #2
    It would appear that -estpost- will accept estimates from -prtest- on the formulation of two groups using the -by()- option, as you have already pointed out. This is confirmed in the documentation for -estpost- which you can read by entering into Stata -help estpost##prtest-.

    Your solution then, is to reformulate the problem to work with the -prtest, by()- syntax. To this, you will need to reshape your data long, or stack it.

    You did not provide a data example, so I have provided one (silly) example:

    Code:
    clear *
    cls
    
    sysuse auto
    gen high_room = headroom > 3
    keep foreign high_room
    
    prtest foreign == high_room
    
    preserve
    stack foreign high_room, into(response) clear
    rename _stack group
    
    ** use estpost here
    prtest response, by(group)
    
    restore
    
    * carry on ...
    Please note that in future, it is preferred that you spend some time reading the FAQ in order to learn how to ask questions effectively, how to use code tags and provide data examples, and the decorum of this forum.

    Comment


    • #3
      Depending on which statistic you exactly need, you could simply calculate the needed statistics from the returned results of prtest.
      I had to do it recently, so I could offer some advice if you state what exactly you need.

      Comment


      • #4
        Originally posted by Leonardo Guizzetti View Post
        It would appear that -estpost- will accept estimates from -prtest- on the formulation of two groups using the -by()- option, as you have already pointed out. This is confirmed in the documentation for -estpost- which you can read by entering into Stata -help estpost##prtest-.

        Your solution then, is to reformulate the problem to work with the -prtest, by()- syntax. To this, you will need to reshape your data long, or stack it.

        You did not provide a data example, so I have provided one (silly) example:

        Code:
        clear *
        cls
        
        sysuse auto
        gen high_room = headroom > 3
        keep foreign high_room
        
        prtest foreign == high_room
        
        preserve
        stack foreign high_room, into(response) clear
        rename _stack group
        
        ** use estpost here
        prtest response, by(group)
        
        restore
        
        * carry on ...
        Please note that in future, it is preferred that you spend some time reading the FAQ in order to learn how to ask questions effectively, how to use code tags and provide data examples, and the decorum of this forum.
        Dear Leonardo Guizzetti,
        thank you for your quick response. I will consider FAQ for my next post.
        I just did not know how to attach my data. here it is - binary and income values

        prtest alex==dave

        the same problem with ttest

        ttest aveA==aveD




        alex dave joe bill aveA aveD aveJ aveM
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 40000 0 40000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 0 0 0 59000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 0 0 37000
        0 0 0 0 0 0 0 0
        0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        1 0 0 0 70000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 230000 0 230000 0
        0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 40000 0 40000 0
        0 0 0 0 0 0 0 0
        1 0 0 0 100000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 0 0 70000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 72500 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 0 0 0 70000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 1 50000 0 0 50000
        0 0 1 1 0 0 80000 80000
        1 0 1 0 150000 0 150000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 0 0 0 80000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 1 50000 0 0 50000
        1 0 0 0 50000 0 0 0
        1 0 0 0 37500 0 0 0
        0 1 0 42500
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 0 0 0 80000 0
        0 0 0 0 0 0 0 0
        1 0 1 50000 0 50000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 45000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 1 0 0 0 57500
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 140000 0 140000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 50000 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 1 60000 0 0 60000
        1 0 1 0 65000 0 65000 0
        0 0 0 0 0 0 0 0
        0 0 1 0 0 0 32500 0
        0 0 1 0 0 0 50000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 1 0 0 100000 100000
        0 0 0 0 0 0 0 0
        1 0 0 0 75000 0 0 0
        1 0 1 1 150000 0 150000 150000
        1 0 0 0 50000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 1 0 0 60000 60000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 1 0 0 0 100000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 115000 0 0 0
        0 0 1 1 0 0 30000 30000
        1 0 0 0 271000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 0 0 0 48000 0
        0 0 0 0 0 0 0 0
        1 0 0 0 0 0 0
        1 0 0 0 139000 0 0 0
        1 0 0 0 90000 0 0 0
        0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 1 67500 0 67500 67500
        1 0 0 0 80000 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 45000 0 45000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 1 37500 0 37500 37500
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        1 0 0 60000 0 0
        0 0 1 0 0 0 37500 0
        1 0 0 0 90000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 175000 0 175000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        1 0 1 0 37500 0 37500 0
        0 0 0 0 0 0 0 0
        1 0 1 0 110000 0 110000 0
        0 0 0 0 0 0
        0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 47250 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 65000 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        1 0 1 0 65000 0 65000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 45000 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 42500 0 42500
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 30000 0 30000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 22500 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 105000 0 105000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        1 0 1 1 30000 0 30000 30000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 40000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 1 0 0 0 50000
        1 0 1 0 48500 0 48500 0
        1 0 1 0 82500 0 82500 0
        1 0 1 0 50000 0 50000 0
        0 0 0 0 0 0 0 0
        1 0 0 0 40000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 45000 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 33000 0 0 0
        1 0 0 0 75000 0 0 0
        1 0 0 0 45000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 105000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 1 0 0 70000 70000
        0 0 0 0 0 0 0 0
        1 0 0 0 50000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 1 0 0 100000 100000
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 1 0 0 0 105000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 70000 0 0 0
        1 0 0 0 75000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 50000 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 80000 0 0 0
        0 0 1 0 0 0 42500 0
        0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 56000 0 56000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 20000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 42500 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 70000 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 265000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 40000 0 40000 0
        1 0 1 0 95000 0 95000 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 1 0 0 0 52250
        1 0 1 0 40000 0 40000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 1 0 0 60000 60000
        1 0 0 0 100000 0 0 0
        1 0 0 0 80000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 30000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 0 0 0 70000 0
        1 0 1 1 70000 0 70000 70000
        0 0 1 0 0 0 95000 0
        0 0 1 0 0 0 175000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 120000 0 120000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 92500 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 1 0 0 0 60000
        0 0 0 0 0 0 0 0
        1 0 0 0 80000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 1 35000 0 35000 35000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 15000 0 0 0
        0 1 0 0 15000 0
        1 0 0 0 15000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 0 17000 17000 17000 0
        0 0 0 0 0 0 0 0
        1 0 0 0 20000 0 0 0
        0 1 1 1 0 20000 20000 20000
        1 1 1 1 20000 20000 20000 20000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 20000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 0 21600 21600 21600 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 1 0 0 0 25500
        0 0 0 0 0 0 0 0
        0 0 1 0 0 0 29000 0
        0 0 0 0 0 0 0 0
        1 0 30000 0
        1 0 0 0 30000 0 0 0
        1 1 1 0 30000 30000 30000 0
        0 0 0 0 0 0 0 0
        1 1 1 1 30000 30000 30000 30000
        0 0 1 0 0 0 30000 0
        1 1 1 0 30000 30000 30000 0
        1 0 0 0 30000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 30000 0 30000 0
        0 0 0 0 0 0 0 0
        1 0 1 0 30100 0 30100 0
        0 0 0 0 0 0 0 0
        1 1 1 1 32500 32500 32500 32500
        0 0 1 0 0 0 32500 0
        0 0 1 0 0 0 32500 0
        0 0 0 0 0 0 0 0
        1 0 0 0 32500 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 32500 32500 32500 32500
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 34000 34000 34000 34000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 35000 35000 35000 35000
        1 1 1 1 35000 35000 35000 35000
        0 1 0 0 35000 0
        0 1 0 0 0 35000 0 0
        1 1 1 1 35000 35000 35000 35000
        0 0 0 1 0 0 0 35000
        0 1 1 0 0 35000 35000 0
        0 0 0 0 0 0 0 0
        1 1 1 1 35000 35000 35000 35000
        1 1 1 1 35000 35000 35000 35000
        1 0 0 0 35000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 1 0 0 37000 0
        0 1 0 0 0 37500 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 40000 40000 40000 40000
        1 1 0 1 40000 40000 0 40000
        0 0 0 0 0 0 0 0
        1 1 1 40000 40000 40000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 40000 0 40000 0
        0 1 0 0 0 40000 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 40000 0 0 0
        1 1 1 1 40000 40000 40000 40000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 1 0 0 0 40000 0
        0 0 0 0 0 0 0 0
        1 1 1 0 40000 40000 40000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 1 0 40000 0 40000 0
        1 1 1 1 40000 40000 40000 40000
        1 1 0 0 40000 40000 0 0
        0 0 0 0 0 0 0 0
        0 1 1 0 0 40000 40000 0
        0 0 0 0 0 0 0 0
        0 0 1 1 0 0 40000 40000
        0 0 1 0 0 0 40000 0
        0 0 0 0 0 0 0 0
        1 1 1 1 40000 40000 40000 40000
        0 1 1 0 0 40000 40000 0
        0 0 0 0 0 0 0 0
        1 1 0 1 40000 40000 0 40000
        0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 0 40000 40000 40000 0
        1 1 1 0 40000 40000 40000 0
        0 1 1 0 0 41000 41000 0
        1 1 1 1 42500 42500 42500 42500
        1 1 0 0 42500 42500 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 1 0 0 0 43000 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 0 1 45000 45000 0 45000
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 1 0 0 0 45000 0 0
        1 1 1 1 45000 45000 45000 45000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 45000 45000 45000 45000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 45000 45000 45000 45000
        0 0 0 0 0 0 0 0
        1 1 1 1 45000 45000 45000 45000
        0 0 0 0 0 0 0 0
        1 1 0 1 45000 45000 0 45000
        0 0 0 0 0 0 0 0
        0 0 0 1 0 0 0 45000
        1 1 1 1 45000 45000 45000 45000
        1 1 1 0 45000 45000 45000 0
        0 0 0 0 0 0 0 0
        1 1 1 1 45000 45000 45000 45000
        1 0 0 0 45750 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 46500 46500 46500 46500
        0 1 1 0 0 47500 47500 0
        0 0 0 0 0 0 0 0
        1 1 1 0 47500 47500 47500 0
        0 0 0 0 0 0 0 0
        0 0 0 0
        0 1 0 1 0 47500 0 47500
        1 1 1 1 47500 47500 47500 47500
        1 1 1 0 50000 50000 50000 0
        0 0 0 0 0 0 0 0
        0 1 0 0 0 50000 0 0
        1 0 0 0 50000 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 1 0 0 0 50000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 50000 50000 50000 50000
        0 1 1 0 0 50000 50000 0
        0 0 0 0 0 0 0 0
        1 1 0 0 50000 50000 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 0 0 50000 50000 0 0
        0 0 0 0 0 0 0 0
        1 1 1 0 50000 50000 50000 0
        1 1 1 0 50000 50000 50000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 1 0 0 0 50000 0 0
        1 1 0 0 50000 50000 0 0
        1 1 1 1 50000 50000 50000 50000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 0 50000 50000 50000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 50000 50000 50000 50000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 1 1 0 0 50000 50000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 52500 52500 52500 52500
        0 0 0 0 0 0 0 0
        0 1 1 0 0 54841 54841 0
        1 1 1 1 55000 55000 55000 55000
        1 1 1 1 55000 55000 55000 55000
        1 1 1 1 55000 55000 55000 55000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 55000 55000 55000 55000
        1 1 1 1 56750 56750 56750 56750
        1 0 1 0 57500 0 57500 0
        0 0 0 0 0 0 0 0
        0 1 0 0 0 57500 0 0
        1 1 1 1 60000 60000 60000 60000
        1 1 1 1 60000 60000 60000 60000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 60000 60000 60000 60000
        1 0 1 1 60000 0 60000 60000
        1 1 1 1 60000 60000 60000 60000
        0 0 1 0 0 0 60000 0
        0 0 0 0 0 0 0 0
        1 1 1 1 60000 60000 60000 60000
        0 0 0 0 0 0 0 0
        1 1 1 1 60000 60000 60000 60000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 60000 60000 60000 60000
        0 0 0 0 0 0 0 0
        1 1 1 1 60000 60000 60000 60000
        0 0 0 0 0 0 0 0
        1 0 60000 0
        1 1 1 1 60000 60000 60000 60000
        1 0 0 0 60750 0 0 0
        1 1 0 0 62500 62500 0 0
        1 1 0 62500 62500 0
        0 0 0 1 0 0 0 63000
        0 0 0 0 0 0 0 0
        0 1 1 0 0 63250 63250 0
        1 1 65000 65000
        0 0 0 1 0 0 0 65000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 0 65000 65000 65000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 65000 65000 65000 65000
        0 1 1 0 0 65000 65000 0
        1 1 1 0 67500 67500 67500 0
        1 1 0 1 67500 67500 0 67500
        1 1 1 1 70000 70000 70000 70000
        0 1 0 0 0 70000 0 0
        0 0 1 0 0 0 70000 0
        1 1 1 70000 70000 70000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 0 70000 70000 70000 0
        0 1 1 0 0 70000 70000 0
        0 0 0 0 0 0 0 0
        1 0 0 72500 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 72500 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 1 0 1 0 72500 0 72500
        1 0 1 0 72500 0 72500 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 0 0 0 72500 0 0 0
        0 0 0 0 0 0 0 0
        0 1 1 0 0 72500 72500 0
        0 0 0 0 0 0 0 0
        0 1 0 0 0 72500 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 0 75000 75000 75000 0
        1 1 1 1 75000 75000 75000 75000
        1 1 1 1 75000 75000 75000 75000
        1 0 0 0 75000 0 0 0
        1 0 0 0 75000 0 0 0
        1 0 0 0 75000 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 75000 75000 75000 75000
        1 1 1 1 75000 75000 75000 75000
        1 1 1 0 77500 77500 77500 0
        1 1 1 0 77500 77500 77500 0
        0 1 0 0 0 79000 0 0
        0 0 0 0 0 0
        1 1 1 1 80000 80000 80000 80000
        1 1 1 1 80000 80000 80000 80000
        1 1 1 1 80000 80000 80000 80000
        1 1 1 1 80000 80000 80000 80000
        1 1 1 0 80000 80000 80000 0
        1 1 0 0 80000 80000 0 0
        1 1 1 1 80000 80000 80000 80000
        1 1 1 1 80000 80000 80000 80000
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 82000 82000 82000 82000
        1 1 1 1 82000 82000 82000 82000
        1 0 1 0 82500 0 82500 0
        1 1 0 0 82500 82500 0 0
        0 1 0 0 0 82500 0 0
        1 0 0 0 82500 0 0 0
        0 0 1 0 0 0 84000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 89000 89000 89000 89000
        1 1 1 0 90000 90000 90000 0
        1 1 1 1 90000 90000 90000 90000
        0 0 0 0 0 0 0 0
        1 0 0 0 90500 0 0 0
        1 0 0 0 90500 0 0 0
        1 1 1 1 92500 92500 92500 92500
        1 1 0 0 95000 95000 0 0
        1 1 1 1 95000 95000 95000 95000
        1 1 1 1 95000 95000 95000 95000
        1 0 1 0 95000 0 95000 0
        1 1 1 1 97500 97500 97500 97500
        1 1 1 1 97500 97500 97500 97500
        0 0 0 0 0 0 0 0
        1 1 0 0 100000 100000 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 0 100000 100000 100000 0
        0 0 0 0 0 0 0 0
        1 1 0 100000 100000 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 1 1 0 0 100000 100000 0
        1 1 1 1 100000 100000 100000 100000
        1 1 1 1 100000 100000 100000 100000
        1 1 1 100000 100000 100000
        1 1 1 0 100000 100000 100000 0
        0 1 1 1 0 100000 100000 100000
        1 1 0 104500 104500 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        1 1 1 1 105000 105000 105000 105000
        1 1 1 1 107500 107500 107500 107500
        1 1 1 1 107500 107500 107500 107500
        1 1 0 0 111000 111000 0 0
        1 1 1 0 115000 115000 115000 0
        0 0 1 1 0 0 115000 115000
        1 1 1 0 115000 115000 115000 0
        1 0 0 0 115000 0 0 0
        1 1 1 1 116000 116000 116000 116000
        0 0 0 0
        1 1 0 0 123500 123500 0 0
        1 1 1 0 123500 123500 123500 0
        1 1 1 1 124000 124000 124000 124000
        1 0 0 0 125000 0 0 0
        1 1 1 1 125000 125000 125000 125000
        1 1 1 1 125000 125000 125000 125000
        1 1 1 1 130000 130000 130000 130000
        0 0 0 0 0 0 0 0
        1 0 1 0 140000 0 140000 0
        0 0 0 0 0 0 0 0
        1 1 1 0 150000 150000 150000 0
        1 1 1 1 155000 155000 155000 155000
        1 1 1 1 160000 160000 160000 160000
        1 1 1 1 185000 185000 185000 185000
        1 1 1 1 295000 295000 295000 295000
        1 1 1 1 600000 600000 600000 600000
        0 1 1 0 73000 73000
        0 0 0 0 0 0
        0 0 0 0 0 0
        0 0
        0 0 0 0
        0 0 0 0 0 0
        0 0
        0 1 0 34000
        0 0
        0 0 0 0
        0 0 0 0
        1 0 50500 0
        1 37000
        1 1 52000 52000
        0 0 0 0
        0 0 0 0
        0 0
        0 1 0 0 42500 0
        1 1 1 0 0
        0 1 0 45000
        0 0 0 0 0 0
        0 1 0 42500
        1 0 75500 0
        0 0 0 0 0 0 0 0
        1 1 1 0 0
        1 0 1 0 0 0
        0 0 0 0
        0 0
        0 0 0 0
        0 0 0 0
        0 0 0 0 0 0
        0 0 0 0
        0 0
        0 0 0 0 0 0
        0 0 0 0 0 0
        0 0 0 0 0 0 0 0
        0 0 1 0 0 0 0
        0 0 0 0 0 0

        Comment


        • #5
          Originally posted by Leonardo Guizzetti View Post
          It would appear that -estpost- will accept estimates from -prtest- on the formulation of two groups using the -by()- option, as you have already pointed out. This is confirmed in the documentation for -estpost- which you can read by entering into Stata -help estpost##prtest-.

          Your solution then, is to reformulate the problem to work with the -prtest, by()- syntax. To this, you will need to reshape your data long, or stack it.

          You did not provide a data example, so I have provided one (silly) example:

          Code:
          clear *
          cls
          
          sysuse auto
          gen high_room = headroom > 3
          keep foreign high_room
          
          prtest foreign == high_room
          
          preserve
          stack foreign high_room, into(response) clear
          rename _stack group
          
          ** use estpost here
          prtest response, by(group)
          
          restore
          
          * carry on ...
          Please note that in future, it is preferred that you spend some time reading the FAQ in order to learn how to ask questions effectively, how to use code tags and provide data examples, and the decorum of this forum.
          your solution is good for small data, in my case (I've got 800 observations) STATA gives the following error


          (memory cleared)
          no room to add more observations
          Up to 1,200 observations are allowed with this version of Stata. Other versions are available that
          allow up to 281,474,976,710,655 observations, assuming you have enough memory.

          thus, my problem is still unsolved

          Comment


          • #6
            Originally posted by Sven-Kristjan Bormann View Post
            Depending on which statistic you exactly need, you could simply calculate the needed statistics from the returned results of prtest.
            I had to do it recently, so I could offer some advice if you state what exactly you need.
            thanks for your response. however, I need this for my paper, have to report it nicely. my prof only accepts tables

            Comment


            • #7
              On the basis of #5 and #6, you have, at least, two choices. Manually reproduce the tables that Stata produces in your report. Or, code the test yourself. Or, better still, use the immediate form of -prtest-, called -prtesti-.

              Code:
              clear *
              cls
              
              sysuse auto
              gen high_room = headroom > 3
              keep foreign high_room
              
              prtest foreign == high_room
              
              prop 1.foreign
              local n1 = e(_N)[1,1]
              local pr1 = e(b)[1,1]
              
              prop 1.high_room
              local n2 = e(_N)[1,1]
              local pr2 = e(b)[1,1]
              
              prtesti `n1' `pr1' `n2' `pr2'
              Last edited by Leonardo Guizzetti; 15 Mar 2020, 21:08. Reason: simplified answer

              Comment

              Working...
              X