Al Feiveson <[email protected]> asks:
> Hi - I can't seem to get the syntax correct for the -matvlc-
> option after anova. Here's what the help file says under anova
> postestimation:
>
> <cut>
>
> But when I try the -matvlc- option, I get an error:
>
> Can anyone tell me what's wrong?
>
> <cut>
>
> . test,test(c) mtest matvlc(M)
> option matvlc() not allowed
> r(198);
Currently the -matvlc()- option does not work with the test()
option despite what the documentation says. We will fix the
problem in a future update.
Until the fix is provided, there are 2 ways to work around the
problem.
Lets Start with data Al provided in his second email:
input hr ag id time
84.2 0 1392 0
90.8 0 1392 4
76.1 0 1392 -7
63.6 0 6291 0
62.3 0 6291 -7
66.4 0 6291 4
77.3 1 4011 -7
82.1 1 4011 0
77.6 1 4011 4
51.6 1 5695 0
51.5 1 5695 4
47.9 1 5695 -7
59.7 1 6867 -7
57.1 1 6867 0
49.5 1 6867 4
73.8 1 7108 4
64.5 1 7108 -7
76.4 1 7108 0
72.8 1 7218 0
74.5 1 7218 4
66.2 1 7218 -7
end
Here is the -anova- he is interested in and the command that will
display the underlying order of the coefficients.
anova hr ag/id|ag time
test, showorder
Here is one possible contrast matrix to send into -test-
mat c = (0, 0, 0, 1,-1, 0, 0, 0, 0, 0, 0, 0, 0 \ ///
0, 0, 0, 1, 0,-1, 0, 0, 0, 0, 0, 0, 0)
The test command that is desired is
test, test(c) mtest matvlc(M)
which currently fails because of the inclusion of the -matvlc()-
option
Until a fix is provided, one way to get the -matvlc()- is to
repeat the test typing out the contrasts of interest. (This will
not be fun if there are many nonzero elements in your c matrix).
test _b[time[1]] - _b[time[2]] = 0, notest
test _b[time[1]] - _b[time[3]] = 0, accum matvlc(M1)
To avoid all the typing involved with the _b[] items in the
solution above you can use the following trick. Starting
again with the anova
anova hr ag/id|ag time
test, test(c) mtest
This shows the test. Now we will use the -accum- option to add a
test that will for sure be dropped. We can use the -matvlc()- on
this call.
test 0=0, accum matvlc(Mextra)
If you look at matrix Mextra you will see that it has one extra
row and column of zeros added compared to the matrix M1 we
obtained using solution 1. Just chop off the last row and
column.
mat M2 = Mextra[1..2,1..2]
Compare M1 and M2 and you will see that they are the same.
The drawback of my second solution is that if you use -test-
in "replay" mode
test
it is now showing that extra dropped 0=0 test. If this is a
problem, rerun the test of interest without the matvlc() to reset
it correctly.
In summary the steps I recommend while waiting for the fix is
anova hr ag/id|ag time
mat c = (0, 0, 0, 1,-1, 0, 0, 0, 0, 0, 0, 0, 0 \ ///
0, 0, 0, 1, 0,-1, 0, 0, 0, 0, 0, 0, 0)
quietly test, test(c)
quietly test 0=0, accum matvlc(Mextra)
mat M = Mextra[1..2,1..2]
test, test(c) mtest
Replace -mat c = ...- with your matrix and replace the 1..2,1..2
with the appropriate ending subscripts depending on how many rows
your c matrix has.
Ken Higbee [email protected]
StataCorp 1-800-STATAPC
*
* 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/