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/
_________________________________________________________________