Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: A question about joint F-test


From   "Hui Wang" <[email protected]>
To   [email protected]
Subject   Re: st: A question about joint F-test
Date   Mon, 29 Jan 2007 22:14:01 +0000

Thank you, Joseph.

The -anova- seems to be useful to my problem. The additional question is that when I run your example program, it automatically take x1=5 as the base group in the regression. Is there any way to specify which value of x1 we want to set as the base group? (I know it is fairly easy to do with -xi-. Just type char x1[omit] 1 before the regression if we want x1=1 as the base.)

Hui



From: Joseph Coveney <[email protected]>
Reply-To: [email protected]
To: Statalist <[email protected]>
Subject: Re: st: A question about joint F-test
Date: Tue, 30 Jan 2007 00:25:04 +0900

Hui Wang wrote:

Look at the following regression:
xi: reg y i.x1*i.x2

where x1 takes 5 value, x2 takes 2 value.

after the regression, I can run the F-test:
xi: testparm i.x1*i.x2

which will give me the joint significance test for both the main effect of
x1 and x2 and their interaction effects.

My question is, what if I want to exclude the main effect of x2 in F-test,
and only test the main effect of x1 and its interaction with x2? How to
write the command?

--------------------------------------------------------------------------------

It's slightly easier to use -anova- for this, but you can use -regress-.
Both give the same answer, and both are shown below.

Joseph Coveney

clear
set more off
set seed `=date("`c(current_date)'", "dmy")'
set obs 20
egen byte x1 = fill(1 2 3 4 5 1 2 3 4 5)
egen byte x2 = fill(1 2 1 2)
generate float y = invnorm(uniform())
anova y x1 x2 x1*x2, category(x1 x2)
test x1 x1*x2
xi: regress y i.x1*i.x2
test _Ix1_2 _Ix1_3 _Ix1_4 _Ix1_5 ///
 _Ix1Xx2_2_2 _Ix1Xx2_3_2 _Ix1Xx2_4_2 _Ix1Xx2_5_2
exit

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index