Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Scatter Diagram with trend line


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Scatter Diagram with trend line
Date   Mon, 8 May 2006 12:15:48 +0100

Also checkout 

1. -twoway lfit- in official Stata 

2. -modeldiag-, a user-written package
(use -search- to find location) 

With 2., see e.g. -regplot- within -modeldiag-. 

For example, suppose you 

sysuse auto, clear 
gen gpm = 1/mpg
regress gpm weight 
regplot 

-regplot- works on the last regression-type results. By 
default you get a scatter plot of the response versus 
the (first) predictor named, plus a smooth curve 
of the just fitted relationship. 

Nick 
[email protected] 

Svend Juul
 
> Jagath wants to draw a scatter diagram with a trend line on it
> -------------------------------------------
> 
> You can combine two or more plots in a single graph. Try this:
> 
>     clear
>     sysuse auto.dta
>     twoway (scatter mpg weight)(lfit mpg weight)
> 
> This gives the linear regression estimate. A smooth Lowess curve is
> drawn by:
> 
>     twoway (scatter mpg weight)(lowess mpg weight)
> 

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