Stata 15 help for ci_14_0

Title

[R] ci -- Confidence intervals for means, proportions, and counts (syntax prior to version 14.1)

[The syntax of ci and cii was changed as of version 14.1. This help file documents ci's and cii's old syntax and as such is probably of no interest to you. If you have set version to less than 14.1 in your old do-files, you do not have to translate cis or ciis to modern syntax. This help file is provided for those wishing to debug or understand old code. Click here for the help file of the modern ci and cii commands.]

Syntax

Syntax for ci

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

Immediate command for variable distributed as normal

cii #obs #mean #sd [, ciin_option]

Immediate command for variable distributed as binomial

cii #obs #succ [, ciib_options]

Immediate command for variable distributed as Poisson

cii #exposure #events , poisson [ciip_options]

#succ and #events must be an 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.

options Description ------------------------------------------------------------------------- Main binomial binomial 0/1 variables; compute exact confidence intervals poisson Poisson variables; compute exact confidence intervals exposure(varname) exposure variable; implies poisson 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 total add output for all groups combined (for use with by only) separator(#) draw separator line after every # variables; default is separator(5) level(#) set confidence level; default is level(95) ------------------------------------------------------------------------- by and statsby are allowed with ci; see prefix. aweights and fweights are allowed, but aweights may not be specified with the binomial or poisson option, see weight.

ciin_option Description ------------------------------------------------------------------------- level(#) set confidence level; default is level(95) -------------------------------------------------------------------------

ciib_options Description ------------------------------------------------------------------------- level(#) set confidence level; default is level(95) 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 -------------------------------------------------------------------------

ciip_options Description ------------------------------------------------------------------------- * poisson numbers are Poisson-distributed counts level(#) set confidence level; default is level(95) ------------------------------------------------------------------------- * poisson is required.

Menu

ci

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

cii for variable distributed as normal

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

cii for variable distributed as binomial

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

cii for variable distributed as Poisson

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

Description

ci computes standard errors and confidence intervals for each of the variables in varlist. Normal confidence intervals are produced by default. However, a variety of binomial confidence intervals or exact Poisson confidence intervals can be requested.

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

Options

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

binomial tells ci that the variables are 0/1 variables and that binomial confidence intervals will be calculated. (cii produces binomial confidence intervals when only two numbers are specified.)

poisson specifies that the variables (or numbers for cii) are Poisson-distributed counts; exact Poisson confidence intervals will be calculated.

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 were observed.

exact, wald, wilson, agresti, and jeffreys specify that variables are 0/1 and 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.

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

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.

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

Examples

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

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

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

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

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

Obtain exact Poisson confidence interval for a count variable . ci count, poisson

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

Obtain confidence intervals for total exposure variables . ci deaths, exposure(pyears)

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

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

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

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

Obtain Poisson confidence intervals for data with 1 exposure and 27 events . cii 1 27, poisson ---------------------------------------------------------------------------

Video examples

Immediate commands in Stata: Confidence intervals for Poisson data

Immediate commands in Stata: Confidence intervals for binomial data

Immediate commands in Stata: Confidence intervals for normal data

Stored results

ci and cii store the following in r():

Scalars r(N) number of observations or exposure r(mean) mean r(se) estimate of standard error r(lb) lower bound of confidence interval r(ub) upper bound 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