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: Margins & margins plot after quantile regression


From   Richard Williams <[email protected]>
To   [email protected], [email protected]
Subject   Re: st: Margins & margins plot after quantile regression
Date   Fri, 20 Jan 2012 09:55:35 -0500

At 06:11 AM 1/20/2012, Fred Wolfe wrote:
Can someone tell me how to get the marginal effects after the
following command for all of the quantiles.

. sqreg dfness age gender,q(.25 .50 .75 .95)
(fitting base model)
(bootstrapping ....................)

Simultaneous quantile regression                     Number of obs =      2488
bootstrap(20) SEs .25 Pseudo R2 = 0.0386 .50 Pseudo R2 = 0.0731 .75 Pseudo R2 = 0.0908 .95 Pseudo R2 = 0.1248

------------------------------------------------------------------------------
             |              Bootstrap
dfness | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
q25          |
age | .0410552 .0038733 10.60 0.000 .03346 .0486505 gender | .656884 .0742087 8.85 0.000 .5113666 .8024013 _cons | -1.023816 .1525062 -6.71 0.000 -1.322868 -.7247635
-------------+----------------------------------------------------------------
q50          |
age | .0821105 .0051305 16.00 0.000 .0720499 .092171 gender | .7389944 .1777711 4.16 0.000 .3903997 1.087589 _cons | -.859595 .3019741 -2.85 0.004 -1.451742 -.2674482
-------------+----------------------------------------------------------------
q75          |
age | .1129019 .0051985 21.72 0.000 .1027082 .1230957 gender | .9032154 .2762264 3.27 0.001 .3615577 1.444873 _cons | .2078413 .42155 0.49 0.622 -.6187842 1.034467
-------------+----------------------------------------------------------------
q95          |
age | .172041 .0086505 19.89 0.000 .155078 .189004 gender | .3010708 .6610339 0.46 0.649 -.9951631 1.597305 _cons | 4.46586 1.153358 3.87 0.000 2.204218 6.727502
------------------------------------------------------------------------------


. margins, at(age=(20 [10] 80))

<snip>
------------------------------------------------------------------------------
             |            Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
         _at |
1 | .7976641 .073706 10.82 0.000 .6532031 .9421252 2 | 1.208217 .0520172 23.23 0.000 1.106265 1.310168 3 | 1.618769 .0478113 33.86 0.000 1.525061 1.712478 4 | 2.029321 .0645985 31.41 0.000 1.902711 2.155932 5 | 2.439874 .0914708 26.67 0.000 2.260594 2.619153 6 | 2.850426 .1219335 23.38 0.000 2.611441 3.089412 7 | 3.260979 .1538686 21.19 0.000 2.959402 3.562556
------------------------------------------------------------------------------

This is apparently margins for q50. I would like margins for all of
the quantiles, with an ultimate goal of using margins plot.

I'd be surprised if it is q50, I would expect q25. I think you have the same problem I have when using ologit -- there are multiple equations so you have to run multiple margins commands, and I don't know how you combine all that into a single marginsplot. Try

margins, at(age=(20 [10] 80)) predict(outcome(#1))
margins, at(age=(20 [10] 80)) predict(outcome(#2))
margins, at(age=(20 [10] 80)) predict(outcome(#3))
margins, at(age=(20 [10] 80)) predict(outcome(#4))

My ongoing wish is that margins easily handle multiple outcome commands. I wrote -mfx2- for the old -mfx- command to handle multiple outcomes. If I ever got ambitious, I could probably write a similar -margins2- command, but I keep hoping Stata will do it for me.


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  [email protected]
WWW:    http://www.nd.edu/~rwilliam

*
*   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