Stata 15 help for ci proportions

[R] ci -- Confidence intervals for means, proportions, and variances

Syntax

Confidence intervals for means, normal distribution

ci means [varlist] [if] [in] [weight] [, options]

cii means #obs #mean #sd [, level(#)]

Confidence intervals for means, Poisson distribution

ci means [varlist] [if] [in] [weight], poisson [exposure(varname) options]

cii means #exposure #events, poisson [level(#)]

Confidence intervals for proportions

ci proportions [varlist] [if] [in] [weight] [, prop_options options]

cii proportions #obs #succ [, prop_options level(#)]

Confidence intervals for variances

ci variances [varlist] [if] [in] [weight] [, bonett options]

cii variances #obs #variance [, level(#)]

cii variances #obs #variance #kurtosis, bonett [level(#)]

Confidence intervals for standard deviations

ci variances [varlist] [if] [in] [weight], sd [bonett options]

cii variances #obs #sd, sd [level(#)]

cii variances #obs #sd #kurtosis, sd bonett [level(#)]

#obs must be a positive integer. #exposure, #sd, and #variance must be a positive number. #succ and #events must be a nonnegative integer or between 0 and 1. If the number is between 0 and 1, Stata interprets it as the fraction of successes or events and converts it to an integer number representing the number of successes or events. The computation then proceeds as if two integers had been specified. If option bonett is specified, you must additionally specify #kurtosis with cii variances.

prop_options Description ------------------------------------------------------------------------- exact calculate exact confidence intervals; the default wald calculate Wald confidence intervals wilson calculate Wilson confidence intervals agresti calculate Agresti-Coull confidence intervals jeffreys calculate Jeffreys confidence intervals -------------------------------------------------------------------------

options Description ------------------------------------------------------------------------- level(#) set confidence level; default is level(95) separator(#) draw separator line after every # variables; default is separator(5) total add output for all groups combined (for use with by only) -------------------------------------------------------------------------

by and statsby are allowed with ci; see prefix. aweights are allowed with ci means for normal data, and fweights are allowed with all ci subcommands; see weight.

Menu

ci

Statistics > Summaries, tables, and tests > Summary and descriptive statistics > Confidence intervals

cii for a normal mean

Statistics > Summaries, tables, and tests > Summary and descriptive statistics > Normal mean CI calculator

cii for a Poisson mean

Statistics > Summaries, tables, and tests > Summary and descriptive statistics > Poisson mean CI calculator

cii for a proportion

Statistics > Summaries, tables, and tests > Summary and descriptive statistics > Proportion CI calculator

cii for a variance

Statistics > Summaries, tables, and tests > Summary and descriptive statistics > Variance CI calculator

cii for a standard deviation

Statistics > Summaries, tables, and tests > Summary and descriptive statistics > Standard deviation CI calculator

Description

ci computes confidence intervals for population means, proportions, variances, and standard deviations.

cii is the immediate form of ci; see immed for a general discussion of immediate commands.

Options for ci and cii means

+------+ ----+ Main +-------------------------------------------------------------

poisson specifies that the variables (or numbers for cii) are Poisson-distributed counts; exact Poisson confidence intervals will be calculated. By default, confidence intervals for means are calculated based on a normal distribution.

exposure(varname) is used only with poisson. You do not need to specify poisson if you specify exposure(); poisson is assumed. varname contains the total exposure (typically a time or an area) during which the number of events recorded in varlist was observed.

level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is level(95) or as set by set level.

separator(#) specifies how often separation lines should be inserted into the output. The default is separator(5), meaning that a line is drawn after every five variables. separator(10) would draw the line after every 10 variables. separator(0) suppresses the separation line.

total is used with the by prefix. It requests that in addition to output for each by-group, output be added for all groups combined.

Options for ci and cii proportions

+------+ ----+ Main +-------------------------------------------------------------

exact, wald, wilson, agresti, and jeffreys specify how binomial confidence intervals are to be calculated.

exact is the default and specifies exact (also known in the literature as Clopper-Pearson [1934]) binomial confidence intervals.

wald specifies calculation of Wald confidence intervals.

wilson specifies calculation of Wilson confidence intervals.

agresti specifies calculation of Agresti-Coull confidence intervals.

jeffreys specifies calculation of Jeffreys confidence intervals.

See Brown, Cai, and DasGupta (2001) for a discussion and comparison of the different binomial confidence intervals.

level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is level(95) or as set by set level.

separator(#) specifies how often separation lines should be inserted into the output. The default is separator(5), meaning that a line is drawn after every five variables. separator(10) would draw the line after every 10 variables. separator(0) suppresses the separation line.

total is used with the by prefix. It requests that in addition to output for each by-group, output be added for all groups combined.

Options for ci and cii variances

+------+ ----+ Main +-------------------------------------------------------------

sd specifies that confidence intervals for standard deviations be calculated. The default is to compute confidence intervals for variances.

bonett specifies that Bonett confidence intervals be calculated. The default is to compute normal-based confidence intervals, which assume normality for the data.

level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is level(95) or as set by set level.

separator(#) specifies how often separation lines should be inserted into the output. The default is separator(5), meaning that a line is drawn after every five variables. separator(10) would draw the line after every 10 variables. separator(0) suppresses the separation line.

total is used with the by prefix. It requests that in addition to output for each by-group, output be added for all groups combined.

Examples

--------------------------------------------------------------------------- Setup . sysuse auto

Obtain 90% confidence intervals for means of normally distributed variables . ci means mpg price, level(90)

---------------------------------------------------------------------------- Setup . webuse petri

Obtain exact Poisson confidence interval for the mean of a count variable . ci means count, poisson

--------------------------------------------------------------------------- Setup . webuse rm

Obtain confidence interval for a rate based on total exposure . ci means deaths, exposure(pyears)

--------------------------------------------------------------------------- Setup . webuse promonone

Obtain various binomial confidence intervals for proportions . ci proportions promoted . ci proportions promoted, wilson . ci proportions promoted, agresti . ci proportions promoted, jeffreys

--------------------------------------------------------------------------- Setup . webuse peas_normdist

Obtain confidence interval for the variance . ci variances weight

Obtain 90% Bonett confidence interval for the standard deviation . ci variances weight, sd bonett level(90)

-------------------------------------------------------------------------- Obtain confidence interval for mean for data with 166 observations, mean=19509, and sd=4379 . cii means 166 19509 4379

Same as above, but obtain 90% confidence interval . cii means 166 19509 4379, level(90)

Obtain Poisson confidence interval for data with 1 exposure and 27 events . cii means 1 27, poisson

Obtain binomial confidence interval for data with 10 binomial events and 1 observed success . cii proportions 10 1

Same as above, but obtain the Wilson confidence interval . cii proportions 10 1, wilson

Obtain a confidence interval for the variance based on a sample with 15 observations and sample variance of 2.1 . cii variances 15 2.1

Obtain 90% Bonett confidence interval for the standard deviation based on a sample with 15 observations, sd = 0.7, and kurtosis = 5.2 . cii variances 15 0.7 5.2, sd bonett level(90) ---------------------------------------------------------------------------

Stored results

ci means and cii means store the following in r():

Scalars r(N) number of observations or, if poisson is specified, exposure r(mean) mean r(se) estimate of standard error r(lb) lower bound of confidence interval r(ub) upper bound of confidence interval r(level) confidence level of confidence interval

Macros r(citype) normal or poisson; type of confidence interval r(exposure) name of exposure variable with poisson

ci proportions and cii proportions store the following in r():

Scalars r(N) number of observations r(proportion) proportion r(se) estimate of standard error r(lb) lower bound of confidence interval r(ub) upper bound of confidence interval r(level) confidence level of confidence interval

Macros r(citype) exact, wald, wilson, agresti, or jeffreys; type of confidence interval

ci variances and cii variances store the following in r():

Scalars r(N) number of observations r(Var) variance r(sd) standard deviation, if sd is specified r(kurtosis) kurtosis, only if bonett is specified r(lb) lower bound of confidence interval r(ub) upper bound of confidence interval r(level) confidence level of confidence interval

Macros r(citype) normal or bonett, type of confidence interval

References

Brown, L. D., T. T. Cai, and A. DasGupta. 2001. Interval estimation for a binomial proportion. Statistical Science 16: 101-133.

Clopper, C. J., and E. S. Pearson. 1934. The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika 26: 404-413.


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