Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: odd grqreg behavior


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: odd grqreg behavior
Date   Tue, 15 Mar 2011 11:40:10 -0500

This problem can be replicated with

sysuse auto,clear
gen w2= weight/10000
xi i.rep
sqreg mpg w2 _I*,quantile(.1 .2 .3 .4 .5 .6 .7 .8 .9) reps(10) level(95)
grqreg w2, ci ols save(grtest) level(95)
use grtest,clear
l qtile w2*

The problem appears to be limitation in the wordcount() function that
is limiting the number variables -grqreg- uses.  In the above example
the results in grtest.dta are for

sqreg mpg w2 _Irep78_2, q(.1 .2 .3 .4 .5 .6 .7 .8 .9)


The best thing would be to contact the author,  Joao Pedro Azevedo,
but in the mean time if you alter lines 39/40 of _bsqregtrace.ado and
lines 102/103 of grqreg.ado from

        loc tmp0 = wordcount("`e(eqnames)'")
        loc tmp1 = wordcount("`rhs'")

to

        loc tmp0 : word count `e(eqnames)'
        loc tmp1 : word count `rhs'

this should bypass the wordcount() limitation.

Scott


On Sun, Mar 13, 2011 at 4:42 PM, Jeffrey T Grogger
<[email protected]> wrote:
> Dear all:
> I am trying to estimate quantile treatment effects using sqreg, then plot them using grqreg.  To wit:
>
> set seed 1234567
> sqreg allbut_06 treatment _Icl*,quantile(.1 .2 .3 .4 .5 .6 .7 .8 .9) reps(10) level(95)
> grqreg treatment, ci ols save(grtest) level(95)
>
> sqreg produces estimates, and grqreg plots something, but grqreg does not produce the estimates computed by sqreg.  The log file is below, edited for clarity.  The bottom line is that the numbers that grqreg is plotting (in grtest.dta, at bottom of log) are not the coefficients that sqreg is producing.  Any idea what is happening?
> Thanks.
> ---------------------------------------------------------------------------------------------------
> . xi i.clust_match
> i.clust_match     _Iclust_mat_1-50    (naturally coded; _Iclust_mat_1 omitted)
>
> . set seed 1234567
>
> . sqreg allbut_06 treatment _Icl*,quantile(.1 .2 .3 .4 .5 .6 .7 .8 .9) reps(10) level(95)
> (fitting base model)
> (bootstrapping ..........)
>
> Simultaneous quantile regression                     Number of obs =     28048
>  bootstrap(10) SEs                                  .10 Pseudo R2 =    0.0691
>                                                     .20 Pseudo R2 =    0.0816
>                                                     .30 Pseudo R2 =    0.0889
>                                                     .40 Pseudo R2 =    0.0949
>                                                     .50 Pseudo R2 =    0.0980
>                                                     .60 Pseudo R2 =    0.0999
>                                                     .70 Pseudo R2 =    0.0996
>                                                     .80 Pseudo R2 =    0.0978
>                                                     .90 Pseudo R2 =    0.1022
>
> ------------------------------------------------------------------------------
>             |              Bootstrap
>   allbut_06 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
> q10          |
>   treatment |      185.5   44.24246     4.19   0.000     98.78263    272.2174
> _Iclust_m~_2 |     -815.5    205.061    -3.98   0.000     -1217.43   -413.5704
> .
> .
> .
> _Iclust_m~50 |      714.5   311.8173     2.29   0.022     103.3228    1325.677
>       _cons |     3560.5   178.9403    19.90   0.000     3209.768    3911.232
> -------------+----------------------------------------------------------------
> q20          |
>   treatment |        195   46.32869     4.21   0.000     104.1935    285.8065
> _Iclust_m~_2 |    -1458.5   217.0275    -6.72   0.000    -1883.885   -1033.115
> .
> .
> .
> _Iclust_m~50 |      387.5   331.0245     1.17   0.242    -261.3241    1036.324
>       _cons |     5167.5    259.136    19.94   0.000     4659.581    5675.419
> -------------+----------------------------------------------------------------
> q30          |
>   treatment |        152   48.88524     3.11   0.002     56.18255    247.8175
> _Iclust_m~_2 |      -1538   207.7434    -7.40   0.000    -1945.187   -1130.813
> .
> .
> .
> _Iclust_m~50 |        162   415.5631     0.39   0.697    -652.5239    976.5239
>       _cons |       6488   192.1978    33.76   0.000     6111.283    6864.717
> -------------+----------------------------------------------------------------
> q40          |
>   treatment |        150   54.50545     2.75   0.006     43.16666    256.8333
> _Iclust_m~_2 |      -1771   348.4914    -5.08   0.000     -2454.06    -1087.94
> .
> .
> .
> _Iclust_m~50 |       -181   321.9381    -0.56   0.574    -812.0144    450.0144
>       _cons |       7791   188.2547    41.39   0.000     7422.012    8159.988
> -------------+----------------------------------------------------------------
> q50          |
>   treatment |        170   74.49461     2.28   0.022     23.98693    316.0131
> _Iclust_m~_2 |      -1535   332.7787    -4.61   0.000    -2187.263   -882.7375
> .
> .
> .
> _Iclust_m~50 |         40   392.3174     0.10   0.919    -728.9611    808.9611
>       _cons |       8915   143.1329    62.28   0.000     8634.453    9195.547
> -------------+----------------------------------------------------------------
> q60          |
>   treatment |        106   81.76807     1.30   0.195     -54.2694    266.2694
> _Iclust_m~_2 |      -1751   366.1833    -4.78   0.000    -2468.737   -1033.263
> .
> .
> .
> _Iclust_m~50 |      156.5   307.9239     0.51   0.611    -447.0458    760.0458
>       _cons |    10308.5    309.545    33.30   0.000     9701.777    10915.22
> -------------+----------------------------------------------------------------
> q70          |
>   treatment |        130    120.192     1.08   0.279    -105.5822    365.5822
> _Iclust_m~_2 |      -2505    412.422    -6.07   0.000    -3313.367   -1696.633
> .
> .
> .
> _Iclust_m~50 |        -20   442.8143    -0.05   0.964    -887.9377    847.9377
>       _cons |      12345    405.513    30.44   0.000     11550.17    13139.83
> -------------+----------------------------------------------------------------
> q80          |
>   treatment |         85   142.7379     0.60   0.552    -194.7733    364.7733
> _Iclust_m~_2 |      -2221   354.8877    -6.26   0.000    -2916.597   -1525.403
> .
> .
> .
>       _cons |      14371   422.0801    34.05   0.000      13543.7     15198.3
> -------------+----------------------------------------------------------------
> q90          |
>   treatment |         70   255.9348     0.27   0.784    -431.6446    571.6446
> _Iclust_m~_2 |      -3300   584.2882    -5.65   0.000    -4445.233   -2154.767
> .
> .
> .
>       _cons |      18330   448.8874    40.83   0.000     17450.16    19209.84
> ------------------------------------------------------------------------------
>
> . grqreg treatment, ci ols save(grtest) level(95)
> file grtest.dta saved
>
> .
> end of do-file
>
> . use grtest,clear
>
> . list qtile treatment*
>
>     +----------------------------------------+
>     | qtile   treatm~t   treatm~i   treatm~o |
>     |----------------------------------------|
>  1. |    .1     318.00     401.56     234.44 |
>  2. |    .2     320.00     422.07     217.93 |
>  3. |    .3     270.00     401.98     138.02 |
>  4. |    .4     304.00     461.43     146.57 |
>  5. |    .5     285.00     457.46     112.54 |
>     |----------------------------------------|
>  6. |    .6     294.00     481.63     106.37 |
>  7. |    .7     285.00     586.44     -16.44 |
>  8. |    .8     400.00     623.65     176.35 |
>  9. |    .9    1004.50    1489.70     519.30 |
>  10. |   .05          .          .          . |
>     |----------------------------------------|
>  11. |   .15          .          .          . |
>  12. |   .25          .          .          . |
>  13. |   .35          .          .          . |
>  14. |   .45          .          .          . |
>  15. |   .55          .          .          . |
>     |----------------------------------------|
>  16. |   .65          .          .          . |
>  17. |   .75          .          .          . |
>  18. |   .85          .          .          . |
> --Break--
> r(1);

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index