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

# Re: st: Testing difference between margins

 From John Antonakis To statalist@hsphsun2.harvard.edu Subject Re: st: Testing difference between margins Date Thu, 19 May 2011 20:43:36 +0200

```Hi:

```
For those interested, I have been kindly informed how to do this test of differences in margins.
```
Recall, suppose I estimate:

xi: reg y x z x2 xz z2

I then predict y at certain levels of the covariates using "margins", e.g.,

margins, at (x=-2.5 z = -2.5 x2=6.25 x = 6.25 z2=6.25)
margins, at (x=2.5 z = -2.5 x2=6.25 xz = -6.25 z2=6.25)

I can test the differences in margins by combined the command as follows

margins, at(x=-2.5 z = -2.5 x2=6.25 x = 6.25 z2=6.25) ///
at(x=2.5 z = -2.5 x2=6.25 xz = -6.25 z2=6.25) post

Then to perform a test for the difference, one types:

test _b[1._at] = _b[2._at]

Simple as that!

Best,
J.
__________________________________________

Prof. John Antonakis
Faculty of Business and Economics
Department of Organizational Behavior
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland
Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305
http://www.hec.unil.ch/people/jantonakis

Associate Editor
__________________________________________

On 19.05.2011 12:09, John.Antonakis@unil.ch wrote:
> Suppose I estimate:
>
> xi: reg y x z x2 xz z2
>
> I then predict y at certain levels of the covariates using
> "margins", e.g.,
>
> margins, at (x=-2.5 z = -2.5 x2=6.25 x = 6.25 z2=6.25)
> margins, at (x=2.5 z = -2.5 x2=6.25 xz = -6.25 z2=6.25)
>
> I would like to test whether the predict from the first
> margins command is different from the predict of the second
> margins command; of course, I can see whether the confidence
> intervals of the predict overlap (but I would like to do a
> test).
>
> Is there a way to do this?
>
> Best,
> John Antoankis
> *
> *   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/
```