Ticket #836: inexacts.patch

File inexacts.patch, 786 bytes (added by sjamaan, 13 years ago)

Convert numbers to inexact in spearman-rank-correlation function

  • statistics.scm

     
    14951495                                  (- yi-rank mean-y-rank)))
    14961496                             average-x-ranks average-y-ranks)))
    14971497             (rs (if (> (* Lxx Lyy) 0) (/ Lxy (sqrt (* Lxx Lyy))) 0)) ; TODO: think about rs = 1
     1498             (rs (exact->inexact rs))   ; Do not return ratnums
    14981499             (ts (if (= 1 rs) 1 (/ (* rs (sqrt (- n 2))) (sqrt (- 1 (square rs))))))
     1500             (ts (exact->inexact ts))   ; Do not return ratnums
    14991501             (p (t-significance ts (- n 2) #:tails ':both)))
    15001502        (format #t "~%Spearman correlation coefficient ~f, p = ~f~%" rs p)
    15011503        (values rs p))))