ikr.simlib.distributions.discrete

## Class NegBinDistribution

• All Implemented Interfaces:
ReflectionConstructable, ReflectionConstructable3<SimNode,Parameters,RandomNumberGenerator>

public class NegBinDistribution
extends DiscreteDistribution
Negative Binomial Distribution
Meaning: Parameters: Probability, that $$i$$ failed Bernoulli trials with the parameter $$q$$ will precede $$k$$ successes success probability $$q(0 \le q \le 1)$$ number of successful trial $$k \ge 0$$ With mean value and variance parameters: $$q= \frac{VAR[X]}{E[X]}$$ $$k= \frac{E[X]}{VAR[X] - E[X]}$$ Distribution: $$P(X=i) = \binom{i+k-1}{k-1} \cdot q^k \cdot (1-q)^i = \binom{i+ \frac{m^2}{v-m} -1}{ \frac{m^2}{v-m} -1} \cdot (\frac{m}{v})^{\frac{m^2}{v-m}} \cdot (1- \frac{m}{v})^i$$ $$E[X]= \frac{1-q}{q} \cdot k = m$$ $$VAR[X]= \frac{1-q}{q^2} \cdot k = \frac{m}{q} = v$$ $$c_T= \frac{1}{ \sqrt{(1-q) \cdot k}}$$ $$G(z)= \frac{q^k}{(1-(1-q) \cdot z)^k}$$  [...].Distribution = NegBin [...].Distribution.Mean = 5 [...].Distribution.Variance = 10 
• ### Field Summary

Fields
Modifier and Type Field and Description
double negBin_p
double negBin_r
• ### Fields inherited from class ikr.simlib.distributions.Distribution

rng
• ### Fields inherited from interface ikr.simlib.parameters.reflection.ReflectionConstructable

CREATE_INSTANCE_METHOD_NAME
• ### Constructor Summary

Constructors
Constructor and Description
NegBinDistribution(double mean, double variance)
NegBinDistribution(double mean, double variance, RandomNumberGenerator rng)
• ### Method Summary

Methods
Modifier and Type Method and Description
static NegBinDistribution createInstance(SimNode ownNode, Parameters pars, RandomNumberGenerator rng)
int next()
Create random numbers
double nextBetaRandomNumber(double _a, double _b)
double nextGammaRandomNumber(double alpha, double beta)
• ### Methods inherited from class ikr.simlib.distributions.Distribution

getDefaultRNG, getRandomNumberGenerator, reset
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Field Detail

• #### negBin_p

public final double negBin_p
• #### negBin_r

public final double negBin_r
• ### Constructor Detail

• #### NegBinDistribution

public NegBinDistribution(double mean,
double variance,
RandomNumberGenerator rng)
• #### NegBinDistribution

public NegBinDistribution(double mean,
double variance)
• ### Method Detail

• #### createInstance

public static NegBinDistribution createInstance(SimNode ownNode,
Parameters pars,
RandomNumberGenerator rng)
• #### nextBetaRandomNumber

public double nextBetaRandomNumber(double _a,
double _b)
• #### nextGammaRandomNumber

public double nextGammaRandomNumber(double alpha,
double beta)
• #### next

public int next()
Description copied from class: DiscreteDistribution
Create random numbers
Specified by:
next in class DiscreteDistribution