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: How to compare coefficients from ols and quantile regressions


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: How to compare coefficients from ols and quantile regressions
Date   Wed, 28 Nov 2012 09:14:25 +0000

At a guess, as you are excluding some of the data, the command

assert r(N) == _N

is doomed to fail. You could play risky and omit it, or change the
checking to something that makes more sense for your problem.

There may be other problems that arise from your particular dataset.

Nick

On Wed, Nov 28, 2012 at 9:03 AM, Buchs M. <[email protected]> wrote:
> 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: [email protected] [mailto:[email protected]] On Behalf Of Austin Nichols
> Sent: 27 November 2012 16:38
> To: [email protected]
> Subject: Re: st: How to compare coefficients from ols and quantile regressions
>
> JVerkuilen (Gmail) <[email protected]> and Buchs M. <[email protected]>:
>
> 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) <[email protected]> wrote:
>> On Tue, Nov 27, 2012 at 9:54 AM, Buchs M. <[email protected]> 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/


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