How to Graph Point Estimates and 95% Confidence Intervals ...
[Pages:4]Biostatistics 140.621
Graphing Confidence Intervals 1
How to Graph Point Estimates and 95% Confidence Intervals Using Stata 11 or Excel
The methods presented here are just several of many ways to construct the graph.
A. Simplest method using Stata: One simple way in which to portray a graphical representation of the confidence intervals for the difference in mean weight change for each of the age-gender groups is to use the Stata command serrbar, with the option scale(1.96) to provide bars extending to +/- 1.96 standard errors.
1) First, create a new small data set in the editor by manually entering the following variables:
agegen (age-gender group), mean(the mean weight change within an age-gender group), and se (the associated standard error of the mean weight change).
Enter the following values into the Stata data editor:
. list
agegen
mean
se
1.
1
16.125 3.505799
2.
2 22.88889 3.316515
3.
3 6.948718 2.211474
4.
4 14.02941 5.124386
Update: Before step 2, run the following command to turn strings into numbers: . destring, replace
2) Label the agegen variable:
. label define agegen 1 "M < 30" 2 "M 30+" 3 "F < 30" 4 "F 30+"
. label values agegen agegen
. list
agegen
mean
se
1. M < 30
16.125 3.505799
2. M 30+ 22.88889 3.316515
3. F < 30 6.948718 2.211474
4. F 30+ 14.02941 5.124386
? 2009 Johns Hopkins University Department of Biostatistics
10/01/09
Biostatistics 140.621
3) Graph using the serrbar command:
. serrbar mean se agegen, scale (1.96)
Graphing Confidence Intervals 2
30
20
mean
10
0
1
2
3
4
agegen
4) Enhance the serrbar command with some options:
serrbar mean se agegen, scale (1.96) title("95% Confidence Interval for Mean Weight Change") sub("Between Current Weight and Weight at Age 18") yline(0) yline(0) b2(Age-Gender Group) t1(95% Confidence Interval for Mean Weight Change) l1(Weight Change (pounds)) ylab(-5(5)35) xlab(1(1)4) xlabel(, valuelabel)
95% Confidence Interval for Mean Weight Change
Between Current Weight and Weight at Age 18 95% Confidence Interval for Mean Weight Change
Weight Change (pounds) mean
-5 0 5 10 15 20 25 30 35
M < 30
M 30+
agegen
F < 30
Age-Gender Group
F 30+
? 2009 Johns Hopkins University Department of Biostatistics
10/01/09
Biostatistics 140.621
Graphing Confidence Intervals 3
B. Method 2 using Stata:
1) Enter the data as follows, with a separate line for the lower limit of the CI, the mean, and
the upper limit of the CI:
group level change
1
Lower 8.65
1
Mean 16.13
1
Upper 23.60
2
Lower 15.89
2
Mean 22.89
2
Upper 29.89
3
Lower 2.47
3
Mean 6.95
3
Upper 11.43
4
Lower 3.60
4
Mean 14.03
4
Upper 24.46
2) Label the age-gender group variable.
label define agegenf 1 "M < 30" 2 "M 30+" 3 "F < 30" 4 "F 30+" label values group agegenf
3) Sort the data.
egen xmin=min(group), by(group) egen xmax=max(group), by(group) gsort -xmin -xmax group group
4) Plot using the "twoway scatter" command.
twoway scatter change group, msymbol(+) c(L) xlab(1(1)4) ylab(-5(5)35) l2("95% Confidence Interval") l1("for the true mean change in weight") b2(Age-Gender Group) t1(Example of graph comparing 95% confidence intervals) yline(0) xlabel(, valuelabel)
5) The above commands yield the following plot:
Example of graph comparing 95% confidence intervals
95% Confidence Interval for the true mean change in weight
Change -5 0 5 10 15 20 25 30 35
M < 30
M 30+
Group
F < 30
Age-Gender Group
F 30+
? 2009 Johns Hopkins University Department of Biostatistics
10/01/09
Biostatistics 140.621
Graphing Confidence Intervals 4
C. A method using Excel:
Step 1: Enter the data into a new spreadsheet. You will need to enter the group variable, the
mean and the error bound (this is the critical value (t or z) times the standard error, aka the
difference from the mean to the confidence limits). For our example, enter the data as
illustrated below:
Group
Mean
ErrorBound
1
16.13
7.28
2
22.89
7
3
6.95
4.48
4
14.03
10.43
Step 2: Follow the steps below using the "Chart Wizard" to construct the graph.
a) Using the mouse, select the Group and Mean values. b) Click on the "Chart Wizard". c) Select "XY (Scatter)", click "Next". d) Select: Series in Columns, click "Next". e) Remove Gridlines, add axis labels as you want, click "Next". f) Select how you want to store the graph, click "Finish". g) Go into the graph and double-click on one of the data points. h) A menu will appear titled "Format Data Series". i) Select "Y Error Bars" menu. j) In "Display", select "Both". k) In "Error Amount", select "Custom". l) You want to add and subtract the error bounds that you entered into the spreadsheet, so
for each "+" and "-", select the error bounds from your spreadsheet by click and dragging over these values. m) Then select "Okay". The graph you obtain looks something like this:
95% confidence interval for the true mean difference in
weight
Example of 95% confidence intervals
35
30
25 M,30+
20
15
M, ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- how to add 95 confidence interval error bars in word 2010
- interpretation of forest plots part i
- how to add 95 confidence interval error bars in word 2013
- explaining the 95 95 tolerance interval rmtc
- the confidence 95 ellipse
- confidence intervals university of western states
- how to graph point estimates and 95 confidence intervals
- thursday january 13 chapter 7 review
- confidence intervals on effect size
- confidence intervals homework cnx
Related searches
- how to graph absolute value equation
- how to graph absolute value function
- how to graph absolute value
- how to graph least squares regression line
- how to graph a standard deviation graph
- how to graph cos
- how to graph a cosine graph
- how to graph cos function
- how to graph a function
- how to graph systems of inequalities
- how to graph an inequality
- how to graph y 5x