Statalist The Stata Listserver


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

st: RE: Plotting stored estimates


From   "Newson, Roger B" <r.newson@imperial.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Plotting stored estimates
Date   Tue, 8 Aug 2006 17:37:09 +0100

This looks like a possible job for the -parmest- package, downloadable
from SSC. The -parmest- package creates an output dataset (or
resultsset) of estimation results, with one observation per parameter
(or per parameter per by-group) and data on the parameter estimates,
confidence limits, P-values or other parameter attributes requested by
the user. This output dataset can then be input into a graphics command,
such as the SSC package -eclplot-, which 
produces confidence interval plots. More about -parmest- and other
resultsset-related commands can be found on my website (see my signature
below).

An alternative is to use Benn Jann's -estout- command, downloadable from
SSC, which can produce spreadsheets of estimation results, which can
also be loaded back into Stata to produce plots.

I hope this helps.

Roger


Roger Newson
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London 
Royal Brompton campus 
Room 33, Emmanuel Kaye Building 
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk 
www.imperial.ac.uk/nhli/r.newson/

Opinions expressed are those of the author, not of the institution.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Sara Mottram
Sent: 08 August 2006 17:02
To: statalist@hsphsun2.harvard.edu
Subject: st: Plotting stored estimates

Apologises if this is a basic question.
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?
I have included my code and out put below.
Sara

. mean kcons, over(age_cat)

Mean estimation                     Number of obs    =     742

    _subpop_1: age_cat = 50-54
    _subpop_2: age_cat = 55-59
    _subpop_3: age_cat = 60-64
    _subpop_4: age_cat = 65-69
    _subpop_5: age_cat = 70-74
    _subpop_6: age_cat = 75-79
    _subpop_7: age_cat = 80+

--------------------------------------------------------------
        Over |       Mean   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
kcons_p18m   |
   _subpop_1 |   .2911392   .0514379      .1901578    .3921207
   _subpop_2 |   .2205882   .0356868      .1505289    .2906475
   _subpop_3 |    .221374    .036413      .1498892    .2928589
   _subpop_4 |   .3164557   .0371185      .2435858    .3893256
   _subpop_5 |   .2605042   .0404049      .1811825    .3398259
   _subpop_6 |   .3766234   .0555805      .2675095    .4857373
   _subpop_7 |   .4047619   .0766573      .2542706    .5552532
--------------------------------------------------------------

. estimates store propnknee
. plot _est age_cat

       2 + 
    e    | 
    s    | 
    a    | 
    m    | 
    p    | 
    l    | 
    e    | 
    (    | 
    )    | 
         | 
    f    | *         *          *          *         *          *
*
    r    | 
    o    | 
    m    | 
         | 
    e    | 
    s    | 
    t    | 
    i    | 
       0 + 
 
+----------------------------------------------------------------+
                1                     age_cat
7



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