Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: correct confidence intervals of -mean- ?

 From Tirthankar Chakravarty To statalist@hsphsun2.harvard.edu Subject Re: st: correct confidence intervals of -mean- ? Date Sat, 6 Mar 2010 19:05:38 +0530

```Hi Dirk,

I assume the behaviour you are looking for is given by:
mean price if rep78==1
etc.

The reason for the CIs being the way they are in the output of -mean-
is because the degrees of freedom takes into account the calculation
of a covariance matrix with observations in other subpopulations
(albeit with covariance restricted to zero). The manual makes this
clear for the estimation of means, but not for the covariance
estimates. Just a guess though.

T

2010/3/6 Dirk Enzmann <dirk.enzmann@uni-hamburg.de>:
> Very carefully I want to ask: Are the confidence intervals given by -mean-
> really correct?
>
> Below I compare the results of -mean- with the results of a different
> procedure:
>
> * --------------------------------------
> sysuse auto, clear
> mean price, over(rep78)
>
> local df = e(df_r)
> display "degrees of freedom = n-1 = `df'"
> * Note that here df is the number of the total sample - 1!
>
> * alternative route:
> collapse (mean) mprice=price (sd) sdprice=price (count) nprice=price if
> (rep78 < .), by(rep78)
> * calculate the confidence intervals the -mean- way:
> gen ci95la = mprice - invttail(`df',.025)*sdprice/sqrt(nprice)
> gen ci95ua = mprice + invttail(`df',.025)*sdprice/sqrt(nprice)
> * calculate the confidence intervals a different way:
> gen ci95lb = mprice - invttail(nprice-1,.025)*sdprice/sqrt(nprice)
> gen ci95ub = mprice + invttail(nprice-1,.025)*sdprice/sqrt(nprice)
> * compare both sets of confidence intervals (..a vs ..b):
> list
> * --------------------------------------
>
> My question: Which procedure is correct?
>
> *************************************************
> Dr. Dirk Enzmann
> Institute of Criminal Sciences
> Dept. of Criminology
> Schlueterstr. 28
> D-20146 Hamburg
> Germany
>
> phone: +49-(0)40-42838.7498 (office)
>       +49-(0)40-42838.4591 (Mrs Billon)
> fax:   +49-(0)40-42838.2344
> email: dirk.enzmann@uni-hamburg.de
> www:
> http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Enzmann.html
> *************************************************
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

--
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```