----- Original Message -----
From: Anuja <[email protected]>
Date: Wednesday, December 29, 2004 1:22 pm
Subject: st: fitting a regression line
> Hi Statausers,
>
> I am regressing Y on X, and then plotting the yhat
> (the predicted values as the x axis ) and Y using
> twoway (scatter pconsp road) (lfit pconsp road)
>
> However I get a straight line, whereas the scatter
> shows me a downward sloping trend. Any help will be
> uselful in the plotting a line in accordance with the
> scatter.
>
> Many thanks,
> Anuja
>
Do you outliers in the data?
For example, compare the effect on the regression line if the outlier is excluded:
clear
input x y
2 6
3 7
4 5
4 6
5 5
6 3
1 10
25 9
end
twoway lfit y x || scatter y x || lfit y x in 1/7, legend(off)
Scott
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/