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: best way to estimate overall mean of clustered, stratified data using xtreg

 From Steve Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: best way to estimate overall mean of clustered, stratified data using xtreg Date Wed, 12 Sep 2012 18:25:59 -0400

```You are describing what was apparently a sample survey of three
districts. I would recommend that you -svyset- your data and use -svy:
mean-. At the very minimum, you would:

svyset village [pweight =??], stratum(district).

You will have to supply the probability weight. This advice might change
if you describe the study design, sampling process, and purpose in more
detail.

Steve

On Sep 12, 2012, at 1:51 PM, Pagel, Christina wrote:

I've got data (9000 ish records) that was collected in 18 clusters (villages) in 3 geographical districts (6 clusters in each district).

I've got a variable that is an integer count variable and I want to estimate its mean across all the data, taking clustering into account (since there is definitely intra cluster correlation).

If there were no districts I would simply do:

Xtreg CountVar, i(TrialCluster) re

And then the returned constant would be the mean and I'd also get confidence intervals.

To take districts into account (the variable is quite dependent on district), I thought I would do:

Xtreg CountVar i.District1 i.District2 i.District3, i(TrialCluster) re

Where the District variables are mutually exclusive binary variables saying which district the record is in...

The question is how do I now get an overall estimate for the mean from the results?

One way I thought of is to generate the estimated value for each record and take the mean of that:

Gen  EstimatedCount=coeff1*District1+coeff2*District2+coeff3*District3+const

And then do:

Means EstimatedCount

To get the estimate of the mean - this works (as in generates a plausible mean) but the condifidence intervals are far too small to be realistic for this data... which makes me think there must be a better way of doing it!

Any suggestions would be gratefully received!

Christina

*
*   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/

*
*   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/
```