Statalist The Stata Listserver


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

RE: st: Plotting stored estimates


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Plotting stored estimates
Date   Wed, 9 Aug 2006 00:44:11 +0100

I share the view that this is not best approached 
as a question depending on stored estimates. In 
addition to -graph bar-, note that the sequence 

egen meankcons = mean(kcons), by(age_cat) 
label var meankcons "fraction consulting with knee pain" 
egen tag = tag(age_cat) 

lets you follow with any reasonable graph command 
using -meankcons- 
as response shown and -if tag- as a way of cutting 
down graph size. 

Nick 
[email protected] 

[email protected]
 
> Rather than using -mean- you could use -graph bar- or -collapse- 
> followed by -scatter- to produce a graph of the mean of kcons by age.
> 
> For example:
> 
> sysuse auto,clear
> graph bar (mean) mpg, over(rep)
> 
> preserve
> collapse (mean) mpg , by(rep)
> scatter mpg rep
> restore

Sara Mottram <[email protected]>
 
> > I have a binary variable kcons which indicates whether or not the 
> > person 
> > has consulted their doctor about knee pain and another variable 
> > age_cat, 
> > indicating the age group to which the person belongs.
> > I have calculated the mean of kcons within each level of age_cat 
> > using 
> > -mean- with the -over()-, option to get the probability of 
> > consulting 
> > with knee pain in each age group. I have then saved these 
> > estimates 
> > using -estimates store-.
> > I would now like to produce a scatter plot the proportion of 
> > people who 
> > consult in each category against age_cat to assess whether there 
> > is a trend.
> > This sounds like it should be straightforward but I can't work out 
> > from 
> > the manuals (I have looked under _estimates in the programming 
> > manual) 
> > and I can't find anything in the FAQs about how to do this. If I 
> > try 
> > scatter _est age_cat, I get a flat plot. I could of course produce 
> > a 
> > plot in Excel by typing in the results of -mean-, but I feel that 
> > this 
> > is probably an important feature that I should learn to use 
> properly?

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