Ricardo Ovaldia <[email protected]> asks:
> I realized yesterday that
> . test foreign=0
> was not valid syntax after -manova-. Although I though
> I should get an "invalid syntax" not a crash.
With the next executable update you will get a
r(198) "invalid syntax"
with this -test- statement after -manova- just as you would after
-anova-.
> I specified:
> . test foreign=0
> because I used it and it work with -mvreg- in Stata 7.
> Should it work the same way?
-anova- and -manova-, unlike almost all other estimation commands
in Stata, deal directly with categorical variables. With
something like -regress- or -mvreg- you end up having to use -xi-
(or something similar) to create dummy variables from your
categorical variables and then using these dummy variables in
your estimation. -anova- and -manova- take care of these issues
automatically.
Let me illustrate the difference with
. mvreg length turn = rep78
versus
. xi : mvreg length turn = i.rep78
versus
. manova length turn = rep78
In the first case -mvreg- treats rep78 as a continuous variable.
The X'X matrix is 2x2 with one column for the constant and one
for the rep78 variable (treated in essence as continuous).
In the second case -xi- creates 4 dummy variables named
_Irep78_2, _Irep78_3, _Irep78_4, and _Irep78_5 (not creating
_Irep78_1 to avoid the linear dependancy with the constant in the
model). -mvreg- is then allowed to operate on these four
indicator (dummy) variables. In this case the X`X matrix is 5x5,
with one column for the constant and four columns for the four
_Irep78_# variables.
In the third case -manova- treats rep78 as a categorical
variable. Internally, it sets up columns in the design matrix
corresponding to the five levels of rep78. These five levels are
referenced by _b[rep78[1]], _b[rep78[2]], ..., _b[rep78[5]]. The
X'X matrix is 6x6, with one column for the constant and five
columns corresponding to the five levels of rep78. The rank of
the matrix is only 5 (not 6) and so one of the coefficients is
dropped during estimation. The -anova- (and also -manova-)
command implements what is called the "overparameterized ANOVA
model". All levels are included and during the sweep operation
appropriate columns/rows are zeroed out to account for the linear
dependencies.
Saying something like
test rep78 = 0
is ambiguous with -anova- or -manova-. Stata is left wondering
what level of rep78 you wish to use.
Now with this as background, think about what happens with a
zero/one variable such as -foreign-. In -anova- and -manova- it
accounts for 2 columns/rows in the X'X matrix. The way these two
columns/rows are refered to is with _b[foreign[1]] and
_b[foreign[2]], meaning the first and second levels of variable
foreign.
Again, saying something like
test foreign = 0
leaves -anova- or -manova- wondering which of the two levels of
foreign you meant. Saying
test _b[foreign[1]] = 0
is clear, and indicates that you want the first level of foreign.
Does this clarify the differences? If not, let me know and I
will try to go into even more detail.
Ken Higbee [email protected]
StataCorp 1-800-STATAPC
*
* 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/