Statalist The Stata Listserver


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

st: RE: line plot with individual's median


From   "Cathy L. Antonakos" <cathya@umich.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: RE: line plot with individual's median
Date   Fri, 1 Sep 2006 17:24:41 -0400 (EDT)

Thanks, this works and is what I needed.

Cathy
---------

Date: Fri, 1 Sep 2006 00:14:34 +0100
From: "Nick Cox" <n.j.cox@durham.ac.uk>
Subject: st: RE: line plot with individual's median

Here is an analogue to your problem as I understand it.

. sysuse auto, clear
(1978 Automobile Data)

. egen median = median(price), by(rep78)

. sort rep78 mpg

. twoway connected price mpg || line median mpg , by(rep78) legend(order(2))

Nick n.j.cox@durham.ac.uk



I am using the following command to plot time-series data for individual nursing home residents.

twoway connected wanpcto hourx, by(resid)

This produces an individual graph for each resident.

Now I want to add the median for the resident - plotted as a line.
I'll calculate that beforehand and call it 'medianpct'.

Is there a way to add a yline command to do that?
*
*   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/

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