Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Testing interaction terms when using factor variables


From   Jeffrey Pitblado <jpitblado@stata.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Testing interaction terms when using factor variables
Date   Thu, 27 Oct 2011 16:15:42 -0500

Richard Williams is using -test- with factor variables notation and would like
to simplify the specification:

I am looking for a shorthand notation when testing multiple interaction terms at
once.

-----------
use "http://www.indiana.edu/~jslsoc/stata/spex_data/tenure01.dta";, clear

quietly logit tenure i.female year c.year#c.year select articles prestige
i.female#(c.year c.year#c.year c.select c.articles c.prestige)

test 1.female#c.year 1.female#c.year#c.year 1.female#c.select
1.female#c.articles 1.female#c.prestige

test 1.female#(c.year c.year#c.year c.select c.articles c.prestige)
-----------

The first test command, where I spell out each interaction separately, works
fine. But, with the second test command, I get

invalid varname
r(198);

You would think there would be some sort of shorthand way of doing this, but if
so I can't figure out what it is.

In Stata 12, Richard can use the new -contrast- command:

    . contrast female#(c.year##c.year c.select c.articles c.prestige), overall

The -overall- option specifies that -contrast- combine the tests of the
individually specified terms into an additional "Overall" test at the end of the
Wald table.

Otherwise, Richard can use -testparm- instead of -test-.

    . testparm 1.female#(c.year c.year#c.year c.select c.articles c.prestige)

--

--Jeff Pitblado
  jpitblado@stata.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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index