Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Quantile vs Quartile regression |
Date | Wed, 29 May 2013 05:57:41 +0100 |
In addition to David's fundamental point, the means of the four -xtile- classes you produced should be at cumulative probabilities .125 .375 .625 .875 in a uniform distribution with no predictors and somewhere else otherwise. There is no reason to suppose that they would ever match your chosen quantiles for -sqreg-. I think this is the point Prakash Singh is making in a different way. (I set aside the small distortions associated with tied values in practice.) Nick njcoxstata@gmail.com On 29 May 2013 04:38, David Hoaglin <dchoaglin@gmail.com> wrote: > Dear Shikha, > > The analyses are intended to produce different summaries, so you > should not expect OLS to give the same result as a quantile > regression. In general, the answer to your question is No. > > It may help to recall that the definition of the regression of Y on X > (when x is a single "continuous" predictor) is the mean of the > distribution of Y at each value of X, formally E(Y|X =x). The > definition does not require that this function of x be a straight > line, though that is often a good approximation. > > Similarly, with several "continuous" predictors, the regression of Y > on those predictors is the mean of the distribution of Y at each > combination of predictor values: E(Y|X1 = x1, X2 = x2, ...). > > For the .50 quantile, the summary you are fitting is the conditional > median, as a function of the predictors. In general it differs from > the conditional mean (i.e., the OLS regression). > > When you form the quartiles of Y and summarize by OLS, the fit is the > conditional mean of the distribution of Y in the particular quartile. > > I hope this helps. > > David Hoaglin > > On Tue, May 28, 2013 at 10:11 PM, Shikha Sinha > <shikha.sinha414@gmail.com> wrote: >> I want to estimate a quantile regression at four quantiles (0.25 0.50 0.75 >> 0.90). I used -sqreg command in stata. However, I was trying another >> method, i.e. divide the sample into four quartiles based on distribution of >> dependent variable (weightGRAM) and run a simple OLS for each quartile. The >> results are shown below in 2. The OLS results are very different from >> -sqreg results. >> >> Can someone explain me the difference between 1 and 2, and is there way to >> replciate results in 1 by running an OLS model? >> >> >> 1. sqreg weightGRAM member child_age , quantile(.25 .50 .75 .90) nolog >> >> 2. xtile qweight=weightGRAM,nq(4) >> >> . ta qweight >> >> 4 quantiles >> of >> weightGRAM Freq. Percent Cum. >> >> 1 2,738 25.13 25.13 >> 2 2,778 25.49 50.62 >> 3 2,730 25.05 75.67 >> 4 2,651 24.33 100.00 >> >> Total 10,897 100.00 >> >> . bys qweight: reg weightGRAM member child_age > * > * 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/