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" <>
To   <>
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- 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. 


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:

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