..-
help for ^cid^                                          (statalist Mar. 20, 1998)
..-

Confidence intervals for differences
- ------------------------------------

  ^cid^  varname [^if^ exp] [^in^ range] [^, m^edian ^l^evel^(^#^)^ ]

  ^cid^  varname1 varname2 [^if^ exp] [^in^ range] [^, m^edian ^unp^aired ^une^qual
	^l^evel^(^#^)^ ]

  ^cid^  varname [^if^ exp] [^in^ range]^, by(^groupvar^)^ [ ^m^edian ^unp^aired ^une^qual
	^l^evel^(^#^)^ ]


^cid^ calculates confidence intervals (CIs) for means or differences.

In the first form, ^cid^ calculates a CI for the mean of varname.

In the second form, ^cid^ produces a CI for mean difference between varname1 and
varname2.  Data are assumed to be paired, but ^unpaired^ changes this assumption.

In the third form, ^cid^ gives a CI for the mean difference across the two groups
defined by groupvar.  Data are assumed paired, but ^unpaired^ reverses this.


Options
- -------

^median^ calculates CI's as above, except for medians rather than for means.
    CI's are determined by rank-based methods as described in Gardner and
    Altman's (1989) book "Statistics with Confidence", pp. 74-79.  A normal
    approximation with a continuity correction of 0.5 is used, rather than
    tables of exact values.  The accuracy should be adequate when both groups
    have at least 5 observations.

    Note that the CI for a single median is obtained using a method different
    from that used by the @centile@ command, so will not be identical.

    WARNING: calculation of CIs for unpaired medians requires storage space for
    n1 * n2 observations, where n1 and n2 are the numbers in each group.  If
    you have insufficient memory, you will get an error message and a ^r(2002);^
    return code.

^unpaired^ indicates that the data are to be treated as unpaired.

^unequal^ indicates that the unpaired data are not to be assumed to have equal
    variances.

^level(^#^)^ defines the percent coverage for the confidence interval.


Examples
- --------

 . ^cid bp2 bp1^
 . ^cid bp2 bp1, median^
 . ^cid bp2 bp1, median unpaired^
 . ^cid bp, by(treatmnt)^
 . ^cid bp, by(treatmnt) median^
 . ^cid bp, by(treatmnt) unpaired^
 . ^cid bp, by(treatmnt) unpaired unequal^


Stored
- ------

	^$S_1^	number of observations
	^$S_2^	degrees of freedom (not used if ^median^ is specified)
	^$S_3^	mean or median difference, group 1 - group 2
	^$S_4^	SEM, or K if ^median^ specified (see Gardner and Altman)
	^$S_5^	lower confidence limit for difference
	^$S_6^	upper confidence limit for difference


Also see
- --------

 Manual:  [R] @ci@, @centile@, @ttest@, @ranksum@, @signrank@.
 
