# Re: st: RE: Comparing means of two variables using -suest-

 From Steven Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: RE: Comparing means of two variables using -suest- Date Tue, 7 Oct 2008 10:02:26 -0400

```
Leonor-

```
1, Means of dummy variables are proportions. To further Martin's question, I am not sure what proportions you want to estimate and compare.
```
Consider the following 2 x 2 table  with n=50 for pension =1
Participate
1           0  Total

Males              5         15    20
Females           10         20    30
Total             15         35    50

This translate into the following table of proportions:
Participate
1           0   Total

Males              .1         .3   .4
Females            .2         .4   .6
Total              .3         .7   1.0

```
With your definitions, the mean of act_m is 0.10. and the mean of act_f is 0.20. Are those the numbers you want? If so, show us a similar table for pension =0 and show us what your hypothesis tests are meant to compare.
```

```
2. Your -svyset- command means that "folio" was a primary sampling unit-- the kind of unit selected in the first-stage of sampling, and that there were other units selected later. Is this correct? Were there any sampling strata? Show us the result of the -svydes- command and please describe the sampling design.
```
```
3. You did not use any -svy- commands in your analysis. However, since I am not sure what the proper analysis is, I won't try to correct your syntax yet.
```

-Steve

On Oct 7, 2008, at 5:13 AM, Martin Weiss wrote:

```
Just out of curiosity. Why not: -proportion male female if participating == 1 & pension == 1- and compare the resulting CIs? The -if- statement records what is common to both groups, namely that they participate and that they
```draw a pension.

HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
```
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Leonor Saravia
```Sent: Tuesday, October 07, 2008 10:08 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: Comparing means of two variables using -suest-

Hello,

I´d like to compare two means of two different groups (dummy
variables), where each one is affected by a grouping variable. I was
looking in the Stata FAQS and found that this was posible with the -
suest - command, but when I use it, it doesn´t work and I don´t know
what´s wrong. I´appreciate if you could give me some advice.

My dummy variables are like this:

act_m = (participating == 1 & male == 1) ; 0 otherwise
act_f =  (participating == 1 & female == 1) ; 0 otherwise
pension = 1 if recieves a pension; 0 otherwise

And I need to compare the 'act_m' mean when 'pension' == 1 with the
mean of 'act_f' when 'pension' == 1.

What I was doing was (and didn´t work):

svyset folio [pw = factor]
```
mean act_m if (hm3_hym == 1 & menor15h == 1) [fw = factorex], over (pension)
```est store act_m1
```
mean act_f if (hm3_hym == 1 & menor15h == 1) [fw = factorex], over (pension)
```est sto act_f1
suest act_m1 act_f1,svy
test [act_m1]pensionh [act_h1]pensionh

The error that Stata brings is:

suest act_m1 act_h1,svy
unable to generate scores for model act_m1
suest requires that predict allow the score	option
r(322);

Well, I´d appreciate very much your help! :)

Leonor

```
Thank you so much Austin!..... This has been very helpful... I appreciate it
```
Regards

Renato

On Feb 24 2008, Austin Nichols wrote:

Renato <ravi0023@umn.edu>:
Try -suest- e.g.

sysuse auto
svyset [pw=wei]
qui svy: reg len for
est sto length
qui svy: reg turn for
est sto turn
qui svy: reg tru for
est sto trunk
suest length turn trunk, svy
test [length]foreign [turn]foreign [trunk]foreign

On 23 Feb 2008 16:34:29 -0600,  <ravi0023@umn.edu> wrote:

```
I have a data base with 2 different test scores and two groups, a treatment group and a control group. I have managed to test whether the mean of each test scores is different among the two groups using svymean and then lincom
```in this way:

svy: mean testA, over(treatment)
lincom [testA]1-[testA]0

svy: mean testB, over(treatment)
lincom [testB]1-[testB]0

```
What I want to do is jointly test whether both variables (testA and testB) are jointly statistically different among the two groups, but incorporating
```the sample design in my estimation.

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

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