Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: fitting a regression line


From   [email protected]
To   [email protected]
Subject   Re: st: fitting a regression line
Date   Wed, 29 Dec 2004 15:37:03 -0600

----- 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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index