Raphael Fraser wrote:
Yes the results was exactly as indicated in the book. However, the
Wald test of the fixed effects of GROUP or TIME are not exact. I have
only been able to reproduce the interaction effects as seen below:
[snip]
The group effect should have 1 degree of freedom with chi-sq = 25.43
The time effect should have 3 degrees of freedom with chi-sq = 184.48
--------------------------------------------------------------------------------
What you're seeing in the book are "SAS Type III Analysis" chi-square test
statistics. In a factorial model with an interaction term such as here, these
don't test the same hypotheses as do Wald tests of regression coefficients for
a factor.
The do-file below constructs contrasts and tests them to give you the SAS
Type III Analysis chi-square test statistics of the PROC MIXED output
that you see in the book. Run the do-file below after running the one that
I posted earlier in this thread (which retrieves the dataset and
runs -xtmixed-).
After running the do-file below, you can see in the results of the -test-
commands there what hypotheses (contrasts) you're testing with SAS Type III
Analysis, and that they're are not the same as those by Wald tests conducted
on coefficients in the regression table.
Joseph Coveney
------------------- Begin do-file -------------------
set more off
*
* Cell-mean predictions:
*
local M [lead]_
local mu11 `M'cons + `M'Igroup_1 + `M'Itime_0 + `M'IgroXtim_1_0
local mu12 `M'cons + `M'Igroup_1 + `M'Itime_1 + `M'IgroXtim_1_1
local mu13 `M'cons + `M'Igroup_1 + `M'Itime_4 + `M'IgroXtim_1_4
local mu14 `M'cons + `M'Igroup_1
local mu21 `M'cons + `M'Itime_0
local mu22 `M'cons + `M'Itime_1
local mu23 `M'cons + `M'Itime_4
local mu24 `M'cons
* Confirmation of their correctness:
adjust , by(group time)
forvalues group = 1/2 {
foreach time in 1 2 3 4 {
lincom `mu`group'`time''
}
}
*
* Contrasts for SAS Type III Analysis:
*
* group:
test `mu11' + `mu12' + `mu13' + `mu14' = `mu21' + `mu22' + `mu23' + `mu24'
* time:
test `mu11' + `mu21' = `mu12' + `mu22', notest
test `mu11' + `mu21' = `mu13' + `mu23', notest accumulate
test `mu11' + `mu21' = `mu14' + `mu24', accumulate
exit
-------------------- End do-file ---------------------
*
* 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/