Example from the cigarette data
* "ci" computes confidence interval for the MEAN of a variable
. ci cigs, by(dvsex) level(90)
-> dvsex=men
Variable | Obs Mean Std. Err. [90 Conf. Interval]
---------+-------------------------------------------------------------
cigs | 300 6.5333 0.6121 5.5234 7.5433
-> dvsex=women
Variable | Obs Mean Std. Err. [90 Conf. Interval]
---------+-------------------------------------------------------------
cigs | 300 4.8933 0.4959 4.0750 5.7116
* Notice that the standard error (or standard deviation) of
* the sample mean is not the same as the std. dev. of the variable
* itself (i.e. 0.6121 not equal to 10.6017). We saw in class that
* the st.dev. of the sample mean of X is sqrt(Var(X)/N), where N is the
* sample size.
* Does Stata use the same formula that we do to calculate confidence
* intervals? Use display (or "di" for short) to find out:
. di 6.5333+invt(299,.90)*0.6121
7.543244
* Notice 7.543244 is (to 3 digits) the upper bound of the 90 percent interval
* reported by ci.
* Also notice the use of the invt function to look up values of the
* t distribution. Get help with invt in the tutorial for week 2
This document was created using HTX, a (HTML/TeX) interlacing program written by Chris Ferrall. Document Last revised: 1997/1/5
End of Document stats
[stats Contents] [Previous File]