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: Testing the difference between coefficients with interaction variables

 From Michael Crain To statalist@hsphsun2.harvard.edu Subject Re: st: Testing the difference between coefficients with interaction variables Date Sun, 28 Aug 2011 04:23:19 -0700 (PDT)

```Many thanks. This has been helpful.

--- On Sat, 8/27/11, Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com> wrote:

> From: Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>
> Subject: Re: st: Testing the difference between coefficients with interaction variables
> To: statalist@hsphsun2.harvard.edu
> Date: Saturday, August 27, 2011, 7:21 AM
> I suppose, but there is algebraically
> and statistically no difference
> between this and
>
> testparm c.mpg#i.rep78
>
> Try it for yourself, keeping in mind the redundancy
> requirement
>
> sysuse auto, clear
> regress price c.mpg##i.rep78
> testparm c.mpg#i.rep78
>
> test mpg=(mpg+c.mpg#2.rep78)
> test mpg=(mpg+c.mpg#3.rep78), accum
> test mpg=(mpg+c.mpg#4.rep78), accum
> test mpg=(mpg+c.mpg#5.rep78), accum
>
> T
>
> On Sat, Aug 27, 2011 at 4:14 AM, Michael Crain <michaelcrain@ymail.com>
> wrote:
> >>> reg y x1 x2 x3 x1*x2 x1*x3
> >
> > Might the test between the three groups be:
> >
> > test x1 = (x1 + x1*x2) = (x1 + x1*x3)
> >
> >
> > --- On Sat, 8/27/11, Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>
> wrote:
> >
> >> From: Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>
> >> Subject: Re: st: Testing the difference between
> coefficients with interaction variables
> >> To: statalist@hsphsun2.harvard.edu
> >> Date: Saturday, August 27, 2011, 4:00 AM
> >> But that is implicit in what you are
> >> testing (combine equation 1 and
> >> negative of equation 2 to get first of second
> set). Recall
> >> that Wald
> >> tests need the row rank of the constraint matrix
> to be full
> >> - the
> >> latter two constraints are redundant and would
> >> degenerate
> >> constraint matrix.
> >>
> >> T
> >>
> >> On Sat, Aug 27, 2011 at 12:43 AM, Michael Crain
> <michaelcrain@ymail.com>
> >> wrote:
> >> >> /****************************/
> >> >> sysuse auto, clear
> >> >> regress price c.mpg##i.rep78
> >> >> testparm c.mpg#i.rep78, equal
> >> >> /****************************/
> >> >
> >> >
> >> > The output from this code seems to be testing
> the
> >> joint significance of:
> >> > group 2 - group 3 = 0
> >> > group 2 - group 4 = 0
> >> > group 2 - group 5 = 0
> >> >
> >> >
> >> > I don't see these results testing:
> >> > group 3 - group 4 = 0
> >> > group 4 - group 5 = 0
> >> >
> >> > Am I misinterpreting?
> >> >
> >> >
> >> > --- On Sat, 8/27/11, Tirthankar Chakravarty
> <tirthankar.chakravarty@gmail.com>
> >> wrote:
> >> >
> >> >> From: Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>
> >> >> Subject: Re: st: Testing the difference
> between
> >> coefficients with interaction variables
> >> >> To: statalist@hsphsun2.harvard.edu
> >> >> Date: Saturday, August 27, 2011, 3:10 AM
> >> >> Add the "equal" option:
> >> >>
> >> >> /****************************/
> >> >> sysuse auto, clear
> >> >> regress price c.mpg##i.rep78
> >> >> testparm c.mpg#i.rep78, equal
> >> >> /****************************/
> >> >>
> >> >> T
> >> >>
> >> >> On Sat, Aug 27, 2011 at 12:04 AM, Michael
> Crain
> >> <michaelcrain@ymail.com>
> >> >> wrote:
> >> >> > Yes, I see this is testing for
> differences
> >> between the
> >> >> base group
> >> >> > compared to each of the other
> groups:
> >> >> >
> >> >> > base group - group 2 = 0
> >> >> > base group - group 3 = 0
> >> >> > etc.
> >> >> >
> >> >> > I am trying to test not only base
> group -
> >> group 2 =
> >> >> 0,
> >> >> > but also: group 2 - group 3 = 0
> >> >> >
> >> >> > Can examining coefficients between
> groups
> >> other than
> >> >> the base group be
> >> >> > done in a straightforward way?
> >> >> >
> >> >> >
> >> >> > --- On Sat, 8/27/11, Tirthankar
> Chakravarty
> >> <tirthankar.chakravarty@gmail.com>
> >> >> wrote:
> >> >> >
> >> >> >> From: Tirthankar Chakravarty
> <tirthankar.chakravarty@gmail.com>
> >> >> >> Subject: Re: st: Testing the
> difference
> >> between
> >> >> coefficients with interaction variables
> >> >> >> To: statalist@hsphsun2.harvard.edu
> >> >> >> Date: Saturday, August 27, 2011,
> 2:28 AM
> >> >> >> Here is an example:
> >> >> >>
> >> >> >> /****************************/
> >> >> >> sysuse auto, clear
> >> >> >> regress price c.mpg##i.rep78
> >> >> >> testparm c.mpg#i.rep78
> >> >> >> /****************************/
> >> >> >>
> >> >> >> This tests whether or not the
> coefficient
> >> on "mpg"
> >> >> is
> >> >> >> significantly
> >> >> >> different across categories of
> "rep78".
> >> In this
> >> >> case, you
> >> >> >> are unable
> >> >> >> to reject the hypothesis that
> they are
> >> >> indistinguishable
> >> >> >> from the
> >> >> >> coefficient of "mpg" for the
> base group.
> >> >> >>
> >> >> >> T
> >> >> >>
> >> >> >> On Fri, Aug 26, 2011 at 11:12
> PM, Michael
> >> Crain
> >> >> <michaelcrain@ymail.com>
> >> >> >> wrote:
> >> >> >> > I know testing the
> difference
> >> between
> >> >> coefficients of
> >> >> >> variables is
> >> >> >> > straightforward:
> >> >> >> >
> >> >> >> > reg y x1 x2 x3
> >> >> >> > test x1 = x2 = x3
> >> >> >> >
> >> >> >> > Is the test as
> straightforward for
> >> examining
> >> >> >> coefficients in models
> >> >> >> > with interactions
> variables?
> >> >> >> >
> >> >> >> > reg y x1 x2 x3 x1*x2 x1*x3
> >> >> >> >
> >> >> >> >   where:
> >> >> >> >
> >> >> >> >     x2 and x3 are dummy
> variables
> >> that
> >> >> identify
> >> >> >> groups
> >> >> >> >
> >> >> >> >     the base group is
> when x2=0
> >> and x3=0,
> >> >> group 2
> >> >> >> >     is when x2=1 and
> x3=0, group 3
> >> is when
> >> >> x2=0 and
> >> >> >> x3=1
> >> >> >> >
> >> >> >> > I am interpreting the
> effect of the
> >> base
> >> >> group as x1's
> >> >> >> coefficient. The
> >> >> >> > effect of group 2 is the
> sum of
> >> coefficients
> >> >> of the x1
> >> >> >> and x1*x2
> >> >> >> > variables. Lastly, the
> effect of
> >> group 3 is
> >> >> the sum of
> >> >> >> coefficients of
> >> >> >> > the x1 and x1*x3
> variables.
> >> >> >> >
> >> >> >> > Now, I want to examine
> whether the
> >> effects of
> >> >> the
> >> >> >> three groups are
> >> >> >> > different.
> >> >> >> >
> >> >> >> > Is the test:
> >> >> >> >
> >> >> >> > test x1 = x1*x2 = x1*x3
> >> >> >> >
> >> >> >> > *
> >> >> >> > *   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/
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> Tirthankar Chakravarty
> >> >> >> tchakravarty@ucsd.edu
> >> >> >> tirthankar.chakravarty@gmail.com
> >> >> >>
> >> >> >> *
> >> >> >> *   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/
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Tirthankar Chakravarty
> >> >> tchakravarty@ucsd.edu
> >> >> tirthankar.chakravarty@gmail.com
> >> >>
> >> >> *
> >> >> *   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/
> >> >
> >>
> >>
> >>
> >> --
> >> Tirthankar Chakravarty
> >> tchakravarty@ucsd.edu
> >> tirthankar.chakravarty@gmail.com
> >>
> >> *
> >> *   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/
> >
>
>
>
> --
> Tirthankar Chakravarty
> tchakravarty@ucsd.edu
> tirthankar.chakravarty@gmail.com
>
> *
> *   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/
```