Introduction
Calculating a 95% confidence interval (CI) is a necessary part of many statistical procedures that are based on proportions. In this blog, we’ll show you how to use Stata to generate Wald CIs for proportions.
Example
Let’s say we want a 95% CI for the proportion of individuals who have a disease. Try the following code in Stata to generate the dataset:
set obs 118
gen disease = 0
replace disease = 1 in 39/118
label define disease 0 "Undiagnosed" 1 "Diagnosed"
label value disease disease
label var disease "Disease status"
Get the 95% CI
Now, to get the Wald 95% CI for these data, try:
ci proportions disease, wald
Here’s what you get:
Change the Confidence Level
Let’s say you wanted the results at a 90% CI. Try:
ci proportions disease, level(90) wald
Graphical Support
You could also generate a 95% CI plot, as follows:
ciplot disease
BridgeText can help you with all of your statistical analysis needs.