Login  Register

Re: Solving Two Equations using MATRIX

Posted by Bruce Weaver on Jul 21, 2015; 10:17pm
URL: http://spssx-discussion.165.s1.nabble.com/Solving-Two-Equations-using-MATRIX-tp5730174p5730214.html

Ryan, am I correct in assuming that in your statement of the null hypothesis, M[] represents the mean of the (population) correlations inside the square brackets?  Thanks for clarifying.

p.s. - Ray's great, isn't he.  If I ever start thinking that I'm getting to know quite a bit about statistics & data analysis, I just take a look at Ray, and invariably come away in a humbled condition.  ;-)


Ryan Black wrote
Thanks for the help, David! This is great!!!

The code just needs two modifications....

COMPUTE y=y +w(j,k)*w(h,m) *
            (r(j,h)-r(j,k)*r(k,h))*(r(k,m)-r(k,h)*r(h,m)) +
            (r(j,m)-r(j,h)*r(h,m))*(r(k,h)-r(k,j)*r(j,h)) +
            (r(j,h)-r(j,m)*r(m,h))*(r(k,m)-r(k,j)*r(j,m)) +
            (r(j,m)-r(j,k)*r(k,m))*(r(k,h)-r(k,m)*r(m,h)) .

should be

COMPUTE y=y +w(j,k)*w(h,m) *
            ((r(j,h)-r(j,k)*r(k,h))*(r(k,m)-r(k,h)*r(h,m)) +
            (r(j,m)-r(j,h)*r(h,m))*(r(k,h)-r(k,j)*r(j,h)) +
            (r(j,h)-r(j,m)*r(m,h))*(r(k,m)-r(k,j)*r(j,m)) +
            (r(j,m)-r(j,k)*r(k,m))*(r(k,h)-r(k,m)*r(m,h))) .

and

COMPUTE y=SQRT(.5/??? -1) * y.

should be

COMPUTE y=SQRT(.5/(??? -1)) * y.

x / y = z

where,

y is the estimated standard error and z is approximately standard normal
which tests:

Null Hypothesis: M[rho14,rho25,rho36] =
M[rho15,rho16,rho24,rho26,rho34,rho35]

Thanks again!

Ryan

p.s., thanks to Ray Koopman for referring me to the appropriate 1980
Steiger article which assisted me in constructing the test, and for
providing additional guidance / confirmation along the way

On Sun, Jul 19, 2015 at 11:37 PM, David Marso <[hidden email]> wrote:

> Hi Ryan,
> Good to see you here!
> Here is a simple MATRIX program.
> Please verify that I haven't dropped a stitch.
> Curious as to what this is calculating.
> Could it be related to the Determinant of a matrix?
> If so there is the DET operator .
>
> MATRIX.
> COMPUTE R={1.00, .20, .25, .85, .30, .15;
>             .20,1.00, .10, .05, .70, .30;
>             .25, .10,1.00, .35, .40, .80;
>             .85, .05, .35,1.00, .50, .45;
>             .30, .70, .40, .50,1.00, .55;
>             .15, .30, .80, .45, .55, 1.00}.
> COMPUTE W={0,0,0, 2,-1,-1;
>            0,0,0,-1, 2,-1;
>            0,0,0,-1,-1, 2;
>            0,0,0, 0, 0, 0;
>            0,0,0, 0, 0, 0;
>            0,0,0, 0, 0, 0}.
>
> COMPUTE X=MSUM(R&*W).
> COMPUTE y=0.
> LOOP j=1 TO 3.
> LOOP k=4 TO 6.
> LOOP h=1 TO 3.
> LOOP m=4 TO 6.
> COMPUTE y=y +w(j,k)*w(h,m) *
>             (r(j,h)-r(j,k)*r(k,h))*(r(k,m)-r(k,h)*r(h,m)) +
>             (r(j,m)-r(j,h)*r(h,m))*(r(k,h)-r(k,j)*r(j,h)) +
>             (r(j,h)-r(j,m)*r(m,h))*(r(k,m)-r(k,j)*r(j,m)) +
>             (r(j,m)-r(j,k)*r(k,m))*(r(k,h)-r(k,m)*r(m,h)) .

END LOOP.
> END LOOP.
> END LOOP.
> END LOOP.
> COMPUTE y=SQRT(.5/??? -1) * y.
> END MATRIX.
>
>
>
>
> Ryan Black wrote
> > Dear SPSS-L,
> >
> > Suppose we have a 6X6 correlation matrix. I have two equations I need to
> > solve.
> >
> > The following is GIVEN:
> >
> > COMPUTE r11 = 1.
> > COMPUTE r12 = .20.
> > COMPUTE r13 = .25.
> > COMPUTE r14 = .85.
> > COMPUTE r15 = .30.
> > COMPUTE r16 = .15.
> > COMPUTE r21 = .20.
> > COMPUTE r22 = 1.
> > COMPUTE r23 = .10.
> > COMPUTE r24 = .05.
> > COMPUTE r25 = .70.
> > COMPUTE r26 = .30.
> > COMPUTE r31 = .25.
> > COMPUTE r32 = .10.
> > COMPUTE r33 = 1.
> > COMPUTE r34 = .35.
> > COMPUTE r35 = .40.
> > COMPUTE r36 = .80.
> > COMPUTE r41 = .85.
> > COMPUTE r42 = .05.
> > COMPUTE r43 = .35.
> > COMPUTE r44 = 1.
> > COMPUTE r45 = .50.
> > COMPUTE r46 = .45.
> > COMPUTE r51 = .30.
> > COMPUTE r52 = .70.
> > COMPUTE r53 = .40.
> > COMPUTE r54 = .50.
> > COMPUTE r55 = 1.
> > COMPUTE r56 = .55.
> > COMPUTE r61 = .15.
> > COMPUTE r62 = .30.
> > COMPUTE r63 = .80.
> > COMPUTE r64 = .45.
> > COMPUTE r65 = .55.
> > COMPUTE r66 = 1.
> >
> > COMPUTE wjk14 =  2.
> > COMPUTE wjk15 = -1.
> > COMPUTE wjk16 = -1.
> > COMPUTE wjk24 = -1.
> > COMPUTE wjk25 =  2.
> > COMPUTE wjk26 = -1.
> > COMPUTE wjk34 = -1.
> > COMPUTE wjk35 = -1.
> > COMPUTE wjk36 =  2.
> >
> > FIRST EQUATION:
> >
> > Sum[{j=1,3},{k=4,6}: w[j,k]*r[j,k]]
> >
> > COMPUTE x = wjk14*r14 + wjk15*r15 + wjk16*r16 +
> >             wjk24*r24 + wjk25*r25 + wjk26*r26 +
> >             wjk34*r34 + wjk35*r35 + wjk36*r36.
> >
> > While x is easy to solve outside of MATRIX, I'm curious how x could be
> > solved more efficiently in MATRIX.
> >
> > Suppose the following is GIVEN as well:
> >
> > COMPUTE whm14 =  2.
> > COMPUTE whm15 = -1.
> > COMPUTE whm16 = -1.
> > COMPUTE whm24 = -1.
> > COMPUTE whm25 =  2.
> > COMPUTE whm26 = -1.
> > COMPUTE whm34 = -1.
> > COMPUTE whm35 = -1.
> > COMPUTE whm36 =  2.
> >
> > SECOND EQUATION:
> >
> > y = Sqrt[(.5/(N-1))*Sum[{j=1,3},{k=4,6},{h=1,3},{m=4,6}:
> >          w[j,k]*w[h,m]*(
> >
> >          (r[j,h]-r[j,k]*r[k,h])*(r[k,m]-r[k,h]*r[h,m]) +
> >
> >          (r[j,m]-r[j,h]*r[h,m])*(r[k,h]-r[k,j]*r[j,h]) +
> >
> >          (r[j,h]-r[j,m]*r[m,h])*(r[k,m]-r[k,j]*r[j,m]) +
> >
> >          (r[j,m]-r[j,k]*r[k,m])*(r[k,h]-r[k,m]*r[m,h]))]]
> >
> > As you can see, y is far more tedious to solve outside of MATRIX. The
> > first
> > of 81 "Sum[{..." terms could be solved using COMPUTE as follows:
> >
> > COMPUTE jk14_hm14 =
> >
> wjk14*whm14*((r11-r14*r41)*(r44-r41*r14)+(r14-r11*r14)*(r41-r41*r11)+(r11-r14*r41)*(r44-r41*r14)+(r14-r14*r44)*(r41-r44*r41)).
> >
> > but then I'd have to work it out for the following 80 terms:
> >
> > compute jk15_hm14 = .
> > compute jk16_hm14 = .
> > compute jk24_hm14 = .
> > compute jk25_hm14 = .
> > compute jk26_hm14 = .
> > compute jk34_hm14 = .
> > compute jk35_hm14 = .
> > compute jk36_hm14 = .
> >
> > compute jk14_hm24 = .
> > compute jk15_hm24 = .
> > compute jk16_hm24 = .
> > compute jk24_hm24 = .
> > compute jk25_hm24 = .
> > compute jk26_hm24 = .
> > compute jk34_hm24 = .
> > compute jk35_hm24 = .
> > compute jk36_hm24 = .
> >
> > compute jk14_hm34 = .
> > compute jk15_hm34 = .
> > compute jk16_hm34 = .
> > compute jk24_hm34 = .
> > compute jk25_hm34 = .
> > compute jk26_hm34 = .
> > compute jk34_hm34 = .
> > compute jk35_hm34 = .
> > compute jk36_hm34 = .
> >
> > compute jk14_hm15 = .
> > compute jk15_hm15 = .
> > compute jk16_hm15 = .
> > compute jk24_hm15 = .
> > compute jk25_hm15 = .
> > compute jk26_hm15 = .
> > compute jk34_hm15 = .
> > compute jk35_hm15 = .
> > compute jk36_hm15 = .
> >
> > compute jk14_hm16 = .
> > compute jk15_hm16 = .
> > compute jk16_hm16 = .
> > compute jk24_hm16 = .
> > compute jk25_hm16 = .
> > compute jk26_hm16 = .
> > compute jk34_hm16 = .
> > compute jk35_hm16 = .
> > compute jk36_hm16 = .
> >
> > compute jk14_hm25 = .
> > compute jk15_hm25 = .
> > compute jk16_hm25 = .
> > compute jk24_hm25 = .
> > compute jk25_hm25 = .
> > compute jk26_hm25 = .
> > compute jk34_hm25 = .
> > compute jk35_hm25 = .
> > compute jk36_hm25 = .
> >
> > compute jk14_hm26 = .
> > compute jk15_hm26 = .
> > compute jk16_hm26 = .
> > compute jk24_hm26 = .
> > compute jk25_hm26 = .
> > compute jk26_hm26 = .
> > compute jk34_hm26 = .
> > compute jk35_hm26 = .
> > compute jk36_hm26 = .
> >
> > compute jk14_hm35 = .
> > compute jk15_hm35 = .
> > compute jk16_hm35 = .
> > compute jk24_hm35 = .
> > compute jk25_hm35 = .
> > compute jk26_hm35 = .
> > compute jk34_hm35 = .
> > compute jk35_hm35 = .
> > compute jk36_hm35 = .
> >
> > compute jk14_hm36 = .
> > compute jk15_hm36 = .
> > compute jk16_hm36 = .
> > compute jk24_hm36 = .
> > compute jk25_hm36 = .
> > compute jk26_hm36 = .
> > compute jk34_hm36 = .
> > compute jk35_hm36 = .
> > compute jk36_hm36 = .
> >
> > and then sum the 81 terms and multiply by Sqrt[(.5/(N-1)).
> >
> > Any tips would be most appreciated.
> >
> > Thanks,
> >
> > Ryan
> >
> > =====================
> > To manage your subscription to SPSSX-L, send a message to
>
> > LISTSERV@.UGA
>
> >  (not to SPSSX-L), with no body text except the
> > command. To leave the list, send the command
> > SIGNOFF SPSSX-L
> > For a list of commands to manage subscriptions, send the command
> > INFO REFCARD
>
>
>
>
>
> -----
> Please reply to the list and not to my personal email.
> Those desiring my consulting or training services please feel free to
> email me.
> ---
> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos
> ne forte conculcent eas pedibus suis."
> Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in
> abyssum?"
> --
> View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/Solving-Two-Equations-using-MATRIX-tp5730174p5730175.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).