Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# RE: st: How to compare coefficients from ols and quantile regressions

 From "Buchs M." To "statalist@hsphsun2.harvard.edu" Subject RE: st: How to compare coefficients from ols and quantile regressions Date Wed, 28 Nov 2012 09:03:20 +0000

```Many thanks, Austin, yes, we are interested in comparing the coefficients (based on the question whether the association between household emissions and hh characteristics differs for mean and high emissions). Many coefficients do in fact differ but we'd like to test whether they are significantly different. Since we are working with the same sample here I assume I can't just do it "by hand" using  b1-b2/(se1^2+se2^2)^0.5 because we have to take covariance into account - thus I was wondering whether there is a way to test this in STATA but couldn't find out how.

I tried what you suggested below but got an error message:

. cap prog drop both

. prog both, rclass
1.  reg lnCO2 lnincome adult2 adult3 child1 child2 age age2_100 agetop  femal hhedu1215_m hhedu16_m edum  wlh r
> efeth rur rural_m if exclude~=1 & einc25p==1
2.
.  ret scalar ols=_b[lnincome]
3.  qreg lnCO2 lnincome adult2 adult3 child1 child2 age age2_100 agetop  femal hhedu1215_m hhedu16_m edum  wlh
> refeth rur rural_m if exclude~=1 & einc25p==1, quantile (0.75)
4.  ret scalar qr=_b[lnincome]
5.  su lnCO2 if e(sample), mean
6.  assert r(N)==_N
7.  eret clear
8.  end

. bs ols=r(ols) qr=r(qr):both
(running both on estimation sample)
an error occurred when bootstrap executed both
r(9);

If anyone has any further suggestions or comments they'll be very much appreciated,

Thanks
Milena

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Austin Nichols
Sent: 27 November 2012 16:38
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: How to compare coefficients from ols and quantile regressions

JVerkuilen (Gmail) <jvverkuilen@gmail.com> and Buchs M. <M.Buechs@soton.ac.uk>:

I think the poster is interested in comparing dE(Y|X)/dX from OLS to dF_{.75}(Y|X)/dX from QR, i.e. coefs, not individual predictions.

The trouble is the discontinuous nature of QR, and the lack of scores and cluster-robust inference, which precludes use of -suest- and related models.

I don't know about consistency of the bootstrap for comparisons across effect on conditional means and conditional quantiles (calling
Stas...) but it is at least straightforward to implement:

sysuse auto, clear
g gpm=1/mpg
cap prog drop both
prog both, rclass
reg gpm weight
ret scalar ols=_b[weight]
qreg gpm weight, q(75)
ret scalar qr=_b[weight]
su gpm if e(sample), mean
assert r(N)==_N
eret clear
end
bs ols=r(ols) qr=r(qr):both
test _b[ols]=_b[qr]

On Tue, Nov 27, 2012 at 5:21 PM, JVerkuilen (Gmail) <jvverkuilen@gmail.com> wrote:
> On Tue, Nov 27, 2012 at 9:54 AM, Buchs M. <M.Buechs@soton.ac.uk> wrote:
>> Hi all,
>>
>> I've run two regressions, one OLS and one quantile on the 75th
>> percentile, using the same sample, dependent and independent
>> variables (the dependent variable being household emissions). Now I'd
>> like to test whether the coefficients for individual IVs from these
>> two regressions are significantly different - is this possible and do
>> you know how I could do this in STATA?>
>
> There's no particularly good reason that a QR for the third quartile
> would be directly comparable to the OLS coefficients that I know of,
> but perhaps I'm wrong. Medians often are, as long as the error
> distribution is symmetric and doesn't have heavy tails. What you might
> want to try doing is generate meaningful comparison cases and compute
> the predicted 75th percentile from both regressions.

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

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