Notebook on nbviewer (original) (raw)

require 'distribution'

Create a normally distributed Vector with mean 30 and standard deviation 2

rng = Distribution::Normal.rng(30,2) body_weight = Daru::Vector.new(20.times.map { rng.call }.sort)

Populate chances of survival, assume that people with less body weight on average

are less likely to survive.

survive = Daru::Vector.new [0,0,0,0,0,1,0,1,0,0,1,1,0,1,1,1,0,1,1,1]

df = Daru::DataFrame.new({ body_weight: body_weight, survive: survive })