|
This post is intended for those interested in learning about the L-matrix (a.k.a. coefficient matrix) within a simple linear mixed model and using the TEST subcommand for the MIXED procedure. I demonstrated previously how to compute beta hats using the MATRIX function for a simple linear mixed model.
That post can be found here: http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0912&L=spssx-l&P=R47264 I go a step further in this post using the same example by showing how to compute the type III fixed effect F-statistic, the t-statistics associated with each of three simple pair-wise contrasts using MATRIX, and finally how to invoke the TEST subcommand for the MIXED procedure to output the pair-wise contrast tests. First, we note that the L-matrix for the metal type III fixed effect is defined as: 0 1 -1 0 0 1 0 -1 Second, we write out the three L-matrices reflecting the three pair-wise contrasts: group 1 versus group 2: 0 1 -1 0 group 1 versus group 3: 0 1 0 -1 group 2 versus group 3: 0 0 1 -1 After figuring out how to write all four L-matrices, we are now ready to compute the corresponding F-statistic and three pair-wise contrast t-statistics using the SPSS matrix function. You would embed the following code within the MATRIX function presented in the original post: ***** L is a 4 X 2 coefficient matrix *****. COMPUTE L = {0,1,0,-1; 0,0,1,-1}. COMPUTE F_type3= TRANSPOS(B)*TRANSPOS(L)*GINV(L*GINV(TRANSPOS(X)*INV(V)*X)*TRANSPOS(L))*L*B / RANK(L). ***** L1v2 is a 4 X 1 coefficient matrix *****. COMPUTE L1v2 = {0,1,-1,0}. COMPUTE t_1v2 = SQRT(TRANSPOS(B)*TRANSPOS(L1v2)*GINV(L1v2*GINV(TRANSPOS(X)*INV(V)*X)*TRANSPOS(L1v2))*L1v2*B / RANK(L1v2)). ***** L1v3 is a 4 X 1 coefficient matrix *****. COMPUTE L1v3 = {0,1,0,-1}. COMPUTE t_1v3 = SQRT(TRANSPOS(B)*TRANSPOS(L1v3)*GINV(L1v3*GINV(TRANSPOS(X)*INV(V)*X)*TRANSPOS(L1v3))*L1v3*B / RANK(L1v3)). ***** L2v3 is a 4 X 1 coefficient matrix *****. COMPUTE L2v3 = {0,0,1,-1}. COMPUTE t_2v3 = SQRT(TRANSPOS(B)*TRANSPOS(L2v3)*GINV(L2v3*GINV(TRANSPOS(X)*INV(V)*X)*TRANSPOS(L2v3))*L2v3*B / RANK(L2v3)). print F_type3/title "F_type3". print t_1v2 /title "t _1v2". print t_1v3 /title "t_1v3". print t_2v3 /title "t_2v3". ****END MATRIX CODE********. If you want to conduct formal tests for the pair-wise contrasts, you could simply add these three lines of code at the end of the original MIXED code: /TEST = '1 vs 2' metal 1 -1 0 /TEST = '1 vs 3' metal 1 0 -1 /TEST = '2 vs 3' metal 0 1 -1. Recall that I presented how to fit the model using the RANDOM statement or using the REPEATED statement. These contrasts will work in either code. One final point--The TEST subcommand works for complex contrasts as well. Let's say you were interested in comparing the metal 1 average to the average of metal 2 and 3. Well, your L-matrix would be: 0 1 -.5 -.5 and the TEST subcommand code would be: /TEST = '1 vs 2 and 3' metal 1 -.5 -.5 Hope this is helpful. Ryan |
|
One small correction--the matrices presented were 2x4 and 1x4, not the other way around. -Ryan
|
| Free forum by Nabble | Edit this page |
