home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / DATABASE / SCRIVNER.LBR / CORREL.SCR < prev    next >
Text File  |  2000-06-30  |  3KB  |  68 lines

  1. #announce Calculating a population correlation coefficient.
  2. #define bump,,[[$1 $2=$2+1]] 
  3.               Population Correlation Coefficients
  4.               ===================================
  5.  
  6. Using The All New,Singing,Dancing and Swearing Scrivener.
  7.  
  8.  
  9. 5/8/85
  10.  
  11. [[def4.0]] [[de This is a comment the dlf%4.0f defines the format as floating point of field 4 ]]
  12. [[d n=0]]
  13.  
  14. +----------------------------------------------------------------------------+
  15. |    x           y            x^2              y^2              xy           |
  16. +----------------------------------------------------------------------------+
  17.  
  18.  [[ x=10  ]]    [[ y=6 ]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  19.  
  20.  [[ x=7   ]]    [[ y=4 ]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  21.  
  22.  [[ x=12  ]]    [[ y=7 ]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  23.  
  24.  [[ x=12  ]]    [[ y=8 ]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  25.  
  26.  [[ x=9   ]]    [[ y=10]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  27.  
  28.  [[ x=16  ]]    [[ y=7 ]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  29.  
  30.  [[ x=12  ]]    [[ y=10]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  31.  
  32.  [[ x=18  ]]    [[ y=15]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  33.  
  34.  [[ x=8   ]]    [[ y=5 ]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  35.  
  36.  [[ x=12  ]]    [[ y=6 ]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  37.  
  38.  [[ x=14  ]]    [[ y=11]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  39.  
  40.  [[ x=16  ]]    [[ y=13]]    [[ x^2  ]]      [[ y^2  ]]      [[ x*y  ]] bump [s,,n]
  41.  
  42. ----------------------------------------------------------------------------
  43.  
  44.  [[t   sx ]]    [[t   sy ]]  [[t sxs   ]]    [[t sys    ]]   [[t sxy  ]] 
  45.  
  46. ===========================================================================
  47.  
  48.  
  49. Population coefficient is given by           sum(xy) - sum(x)*sum(y)/n
  50.                                     -------------------------------------------------
  51.                                     sqr[((sum(x)^2)-(sum(x)^2)/n))*((sum(y)^2)-((sum(y)^2)/n)]
  52.  
  53.  
  54.                                  =           [[o sxy ]] - [[o a= sx*sy/n]]
  55.                                     ---------------------------------------
  56.                                              sqr[ [[o b=sxs-((sx^2)/n)]] * [[o c=sys-((sy^2)/n)]] ]
  57.  
  58. [[def5.1]]
  59.                                  =     [[o a=sxy-a]]
  60.                                     ------------------ 
  61.                                        [[o b=(b*c)^0.5 ]]
  62.  
  63.  
  64. [[def5.4]]
  65.  
  66.                                  =  [[ a/b   ]]
  67.  
  68.