1
$\begingroup$

I have a problem considering the length of the y-axis in a LOWESS plot in Stata. The y variable ranges from 0 to 50. I would like to run the LOWESS on all the data but only display the graph for the range of y from 30 to 50. I've searched throughout the net, but I just found that I would also have to restrict the data to $\ge$ 30, but that of course changes the curve. Do you have any advice? The graphs are simply unusable for that y-axis interval. Thanks!

$\endgroup$
1
$\begingroup$

Is this what you have in mind?

sysuse auto
lowess price mpg, gen(yhat)
tw (line yhat mpg if price <12000, sort) (scatter yhat mpg if price <12000)

In practice, this seems like a curious thing to do.

$\endgroup$
  • $\begingroup$ Dimitriy, you are restricting the x-axis. The OP wants to constain the y-axis, probably because their data are wildly skewed, and nothing is seen on the full scale. So rather than if mpg<20, the OP probably wants to entertain if price < 10000... although auto.dta price isn't badly enough skewed for this to make much sense :) $\endgroup$ – StasK Jun 10 '14 at 21:01
  • 1
    $\begingroup$ @StasK If only reading was as easy as using Stata. Excellent point, and fixed. $\endgroup$ – Dimitriy V. Masterov Jun 10 '14 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.