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" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
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 
n.j.cox@durham.ac.uk 

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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index