class Statistics::Distributions::Bernoulli

Overview

The discrete probability distribution of a random variable which takes the value 1 with probability p and the value 0 with probability q=1-p (source: wikipedia).

Defined in:

lib/distributions.cr

Constructors

Instance Method Summary

Instance methods inherited from class Statistics::Distributions::DiscreteDistribution(Int32)

pmf(x) pmf

Instance methods inherited from class Statistics::Distributions::Distribution(Int32)

rand : T rand

Constructor Detail

def self.new(p : Float64) #

Creates Bernoulli distribution with success rate p.


Instance Method Detail

def pmf(x) #

The Probability Mass Function (PMF) of a discrete random variable.


def rand : Int32 #
Description copied from class Statistics::Distributions::Distribution(Int32)

Samples a random variable with the given distribution.