File: statistics.rb

package info (click to toggle)
ruby-narray 0.6.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 468 kB
  • sloc: ansic: 4,498; ruby: 1,329; python: 91; makefile: 7
file content (22 lines) | stat: -rw-r--r-- 380 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require "narray"
include NMath

x = NArray[65, 63, 67, 64, 68, 62, 70, 66, 68, 67, 69, 71]
y = NArray[68, 66, 68, 65, 69, 66, 68, 65, 71, 67, 68, 70]

def test str, x, y=nil
  print str," #=> "
  p eval(str)
end

test "x",x,y
test "y",x,y
test "covariance(x,y)",x,y

a = covariance(x,y)

test "x.stddev",x

test "x.sort",x
test "x.median",x
test "(x+y.newrank!(0)).median(0)",x,y