# Re: st: monthly means & CI

 From Clive Nicholas To statalist@hsphsun2.harvard.edu Subject Re: st: monthly means & CI Date Tue, 13 Mar 2007 05:25:19 +0000 (GMT)

```Gaby Serdan wrote:

I have data on deaths. I need to calculate the mean &
CI of females in proportion to all population. Im
trying first to create a variable for each month then
take the total number of female per month and then
divide by total number of deaths per month.

[...]

Im somehow lost, since my data is per individula.
should I create a different dataset with montly deaths
only or can I calculate means and confidence intervals
in this same dataset.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

My suggestion would be to do the following (after -input-ing the data and variables that you show):

. collapse (sum) female male sex_unknown, by(month year)

The -count- variable seemed to me to be a bit of a red herring in getting what you wanted, so I dispensed with this. Since only one female appears in this snapshot of your data, I created
the variable -prop- which records the monthly proportion of those who
died where their sex is unknown.

. g total=female+male+sex_unknown

. g prop=sex_unknown/total

. sum prop, detail

prop
-------------------------------------------------------------
Percentiles      Smallest
1%          .25            .25
5%          .25             .5
10%           .5              1       Obs                  15
25%            1              1       Sum of Wgt.          15

50%            1                      Mean           .9166667
Largest       Std. Dev.      .2249339
75%            1              1
90%            1              1       Variance       .0505952
95%            1              1       Skewness      -2.346011
99%            1              1       Kurtosis        6.82526

. display .9166667-(.2249339*1.96)

.47579626

. display .9166667+(.2249339*1.96)
1.3575371

I guess you'd need to define which confidence interval you're looking for. The percentiles don't look very informative, and both subtracting and adding 1.96 times the standard deviation to and from the mean (assuming a 95% CI) gives you an upper confidence limit above 1, which makes little sense. However, applying this to all of your data might yield more sensible statistics.

Hope all that helps.

Clive Nicholas

___________________________________________________________
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes.
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```