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

Re: st: ci question

From   Chris Witte <>
Subject   Re: st: ci question
Date   Fri, 11 Apr 2008 08:49:15 -0700 (PDT)

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!

thanks again Nick, David, and Svend


----- Original Message ----
From: Svend Juul <SJ@SOCI.AU.DK>
Sent: Friday, April 11, 2008 7:33:50 AM
Subject: Re: st: ci question

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)")              ///

Hope this helps

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone:  +45 8942 6090
Home:  +45 8693 7796

*  For searches and help try:

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
*   For searches and help try:

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