I want to determine the correlation(relationship) between 2 groups ie. lines 
of  data in 2 separate fields. My best attempt is as below. Can anyone help 
me improve the following script  ?
on mouseUp
  repeat with i = 1 to number of lines in  fld "X"
    if line i of bg  fld  "X" ≠ empty then put line i of bg  fld  "X" & 
return after  a
    if line i of bg  fld  "Y" ≠ empty then  put line i of bg  fld  "Y" & 
return after  b
    if line i of bg  fld  "X" ≠ empty then put (line i of bg  fld  "X") 
*(line i of bg  fld  "Y") & return after  c
    if line i of bg  fld  "X" ≠ empty then put (line i of bg  fld  "X")^2 & 
return after  x
    if line i of bg  fld  "Y" ≠ empty then put (line i of bg  fld  "Y")^2 & 
return after  y
  end repeat
  put replacetext(  a,return,comma) into  a1
  delete last char of  a1
  put sum(replacetext( a1,return,comma)) into  Ex
  put replacetext(  b,return,comma) into  b1
  delete last char of  b1
  put sum(replacetext( b1,return,comma)) into  Ey
  put replacetext(  c,return,comma) into  c1
  delete last char of  c1
  put sum(replacetext( c1,return,comma)) into  Exy
  put replacetext(  x,return,comma) into x2
  delete last char of  x2
  put sum(replacetext( x2,return,comma)) into  Ex2
  put replacetext(  y,return,comma) into y2
  delete last char of  y2
  put sum(replacetext( y2,return,comma)) into  Ey2
  put (number of lines in  fld "X")*Exy-(Ex*Ey) into num
  put (number of lines in  fld "X")*(Ex2)-Ex^2 into denom1
  put  (number of lines in  fld "Y")*(Ey2)-Ey^2 into denom2
  put num/(sqrt(denom1*denom2)) into bg fld "answer"
end mouseUp
Thanks,
mike
[EMAIL PROTECTED]

Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to