# st: BSWREG and difference of means test

 From Alan Diener To statalist@hsphsun2.harvard.edu Subject st: BSWREG and difference of means test Date Fri, 21 Apr 2006 16:20:22 -0400

```I'm trying to test for a difference in means (or in proportions) between
two sub-samples in my data set. i.e. I want to test whether the prevalence
of interest is different bewteen males and females. Since I don't have
I am using the BSWREG command.

I have attempted to test for the difference in proportions in two ways:

Method 1:  regressed prevalence (1=yes, 0=no) on gender (1=female, 0=male).
Then did a t-test, based on the coefficient of the gender variable divided
by the standard error of the gender coefficient.

Method 2: Regressed prevalence  (1=yes, 0=no) on males and females
seperately. This gives the proportion of each gender which stated
prevalence=yes. I then calculated the t-statistic as equal to the
difference in means divided by SQRT(SEmales_squared + SEfemales_squared).

The results from thetwo methods are different as expected because of the
missing covariance term in the denominator of Method 2. There should be a
covariance term as the male and female samples are not indepedent of each
other as a result of the sampling frame.

I'd like to be able to run this test using each method in order to confirm
the results. Does anybody know how I can calculate the t-statistic using
the 2nd method? Or how I can derive the covariance term?

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