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.

# st: RE: using estimate store + suest+test to compare regression coefficients between two samples, how to adjust for clustering

 From "Martin Weiss" To Subject st: RE: using estimate store + suest+test to compare regression coefficients between two samples, how to adjust for clustering Date Mon, 1 Mar 2010 21:51:17 +0100

```<>

"The error message is:
"male was estimated with cluster(family).
re-estimate without the cluster() option, and
specify the cluster() option with suest.
r(322);""

*******
sysuse auto, clear
reg price weight length if foreign
est store for
reg price weight length if !foreign
est store dom
suest for dom, cluster(rep)
test ([for_mean]_b[weight ] = [dom_mean]_b[weight ]) ([for_mean]_b[length ]
= [dom_mean]_b[length ])
testnl ([for_mean]_b[weight ] / [dom_mean]_b[weight ]) =
([for_mean]_b[length ] /[dom_mean]_b[length ])
*******

HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Qian, Yiming
Sent: Montag, 1. März 2010 21:40
To: statalist@hsphsun2.harvard.edu
Subject: st: using estimate store + suest+test to compare regression
coefficients between two samples, how to adjust for clustering

Dear Statalist,

I use "estimates store + suest + test" to compare regression coefficients
between two samples.  It works fine until I tried to adjust clustering in
the regressions. Below are detailed description of the problem. Is there a
way to can get around this problem using "suest" or some alternative
commands?

I ran the same regression for two groups (male vs. female):
Y = a1*x1 + a2*x2 + a3*x3 + ....
I want to test:
1.      The joint hypothesis that a1 and a2 are the same b/w the two groups.
2.      The hypothesis that a1/a2 is the same b/w the two groups.

The following stata codes work fine:
reg y x1 x2 x3 x4 if female==0
estimates store male
reg y x1 x2 x3 x4 if female==1
estimates store male
suest male female
test ([male_mean]_b[x1] = [female_mean]_b[x1]) ([male_mean]_b[x2] =
[female_mean]_b[x2])
testnl [male_mean]_b[x1]/[male_mean]_b[x2] =
[female_mean]_b[x1]/[female_mean]_b[x2])

However, if I add cluster() to the two regressions, I got error messages.
reg y x1 x2 x3 x4 if female==0, cluster(family)
estimates store male
reg y x1 x2 x3 x4 if female==1, cluster(family)
estimates store male
suest male female

The error message is:
"male was estimated with cluster(family).
re-estimate without the cluster() option, and
specify the cluster() option with suest.
r(322);"

Thank you very much!
Yiming Qian

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