Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# RE: st: Naming Equations in Stata

 From "Jesper Lindhardsen" <[email protected]> To <[email protected]> Subject RE: st: Naming Equations in Stata Date Wed, 21 Sep 2011 09:06:08 +0200

```HI Lin,

I may have misunderstood, but if this is a question on whether a
parameter estimate differs between agegroups (in the same dataset), my
guess is that a single equation approach is possible, i.e, use
interaction terms and then -test-/-testpatm- afterwards. However, this
would include x2 x3 covariate estimates across agegroups.

reg y x1#agegroup i.agegroup x2 x3
testparm x1#agegroup,equal

BW, Jesper

Jesper Lindhardsen
MD, PhD candidate
Department of Cardiovascular Research
Copenhagen University Hospital, Gentofte
Denmark

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ian Li
Sent: 21 September 2011 07:09
To: [email protected]
Subject: RE: st: Naming Equations in Stata

Hi Partho,

thanks, that FAQ helped a bit.

I should clarify a little. The 4 samples I referred to were sub-samples
of my dataset. So in effect, suppose I am trying to estimate the same
model for four age groups, I would enter the code as:

reg y x1 x2 x3 if agegroup == 1
reg y x1 x2 x3 if agegroup == 2
reg y x1 x2 x3 if agegroup == 3
reg y x1 x2 x3 if agegroup == 4

How should I test for the equality of the X1s across the four
estimations? The FAQ you posted helps, but it would be much simpler and
straightforward if I could understand how to use the -test- function
properly. To do that, it would be desirable if anyone could advise on
how equations are named in Stata, or what the proper syntax is for the
-test- function.

Regards
Ian
________________________________________
From: [email protected]
[[email protected]] On Behalf Of Partho Sarkar
[[email protected]]
Sent: Wednesday, September 21, 2011 12:54 PM
To: [email protected]
Subject: Re: st: Naming Equations in Stata

Maybe this FAQ article would help:

http://www.stata.com/support/faqs/stat/testing.html

On Wed, Sep 21, 2011 at 9:50 AM, Ian Li <[email protected]> wrote:
> Dear Statalisters,
>
> I am running an OLS regression across four different samples. The
estimating equation is exactly the same for all the samples, for
example, I run:
>
> y = a+b1X1+b2X2+e
>
> I would like to run an F-test to determine if the estimated beta
coefficient b1 in the first sample is equal to b1 in the second sample,
and so on for all four samples. I understand that this can be done using
syntax 4 in the -test- function. The syntax is given as:
>
> test [eqno=eqno[=...]] [: coeflist]      (Syntax 4)
>
> where eqno is the name of the equation. However, the help file does
not describe how equations are named in Stata.
>
> The Statalist archive shows that this question has been posed before,
see:
>
> http://www.stata.com/statalist/archive/2010-09/msg01294.html
>
> The solution given was to use the -sureg- function (seemingly
unrelated regression). However, I do not think that this gives me what I
want, as the vce (robust) function is not compatible with -sureg- (which
I would like to use), and does not seem appropriate given that all I
want is to test the equality of coefficients across equations. The
Statalister who posted the original questions also did not indicate if
the solution was adequate and gave her what she wanted.
>
> Would anyone be able to suggest how I can name equations in Stata, or
an alternative way to get this F-test done, or how -sureg- is
appropriate for my needs?
>
> Regards
> Ian
> *
> *   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/

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