Statalist


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

RE: st: ci question


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: ci question
Date   Fri, 11 Apr 2008 18:25:29 +0100

See also 

SJ-7-1  gr0026  . . . .  Stata tip 42: The overlay problem: Offset for
clarity
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
J. Cui
        Q1/07   SJ 7(1):141--142                                 (no
commands)
        tip for graphing several quantities on a continuous axis

Chris Witte
Subject: Re: st: ci question

thanks for the example Svend!  
I was thinking of doing something like your code,

"replace race=race-0.03 if smoke==0
replace race=race+0.03 if smoke==1"

for offsetting the plots, and this code will take the error out of my
"trial and error" approach to getting the appearance I want.  I'll make
use of your xlabel code as well!

Svend Juul

Chris wrote:

I would like to know how to take the means and standard errors 
calculated from the "ci" command, and plot the means with brackets 
placed at plus/minus the standard error.

1) So, I first need to know how to get these estimates into a 
dataset for use.

2) I found the "serrbar" command, which will do a basic plotting, 
but what I'd really like is to have a way to group these estimates, 
much like the way you can with "graph box" and the "over" option.  
Is this possible?

and later:

... is there a way to horizontally offset the rcap plots within a 
single x-axis value so that the rcaps do not overlap? 

===================================================================

I find -statsby- most convenient to extract a condensed dataset
with the estimatess of interest. The example also demonstrates
a way to horisontally offset the rcaps:

    webuse lbw.dta, clear
    statsby mean=r(mean) se=r(se), by(race smoke) clear : ci bwt
    generate ub = mean + se
    generate lb = mean - se
    replace race=race-0.03 if smoke==0
    replace race=race+0.03 if smoke==1

    twoway (rcap lb ub race)(scatter mean race) , ///
        xlabel(1 "white" 2 "black" 3 "other")      ///
        ytitle("Birthweight (grams)")              ///
        legend(off)


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