utilR#

utilR

pygom.utilR.dbeta(x, shape1, shape2, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Beta.html

pygom.utilR.dbinom(x, size, prob, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Binomial.html

pygom.utilR.dchisq(x, df, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Chisquare.html

pygom.utilR.dexp(x, rate=1.0, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Exponential.html

pygom.utilR.dgamma(x, shape, rate=1.0, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/GammaDist.html

pygom.utilR.dmvnorm(x, mean=None, sigma=None)[source]#

See https://www.rdocumentation.org/packages/mvtnorm/versions/1.0-12/topics/mvnorm

pygom.utilR.dnbinom(x, size, prob=None, mu=None, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-devel/library/stats/html/NegBinomial.html

pygom.utilR.dnorm(x, mean=0, sd=1, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Normal.html

pygom.utilR.dpois(x, mu=1.0, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Poisson.html

pygom.utilR.dunif(x, min=0.0, max=1.0, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Uniform.html

pygom.utilR.gamma_mu_shape(x, mu, shape, log=False)[source]#

The probability density function (pdf) of gamma distrbution in terms of mean and shape.

x: array like observation. mu: mean or prediction. shape: shape (a in latex equation below). log: if True the natural log of the pmf is given. See: Bolker, B. M. (2008). Gamma. In Ecological Models in R (pp. 131–133). Princeton University Press.

Jupyter notebook titled “Loss function Calculations.ipnyb”

pdf, \(\mathcal{p}(x; \mu,a) = \exp(- a \ln{\left(\frac{\mu}{a} \right)} - \frac{a x}{\mu} + \left(a - 1\right) \ln{\left(x \right)} - \ln{\left(\Gamma\left(a\right) \right)})\)

`

pygom.utilR.nb2pmf(x, mu, k, log=False)[source]#

The probability mass function (pmf) of Negative Binomial 2 distribution. This definition of the negative binomial distribution is often refered to as negative binomial 2, or the ecological parameterisation. This parameterisation takes the mean and k (an overdispersion parameter). The variance = mean(1+mean/k), some notation uses alpha (k=1/alpha). See: Bolker, B. M. (2008). Negative Binomial. In Ecological Models in R (pp. 124–126). Princeton University Press.

Jupyter notebook titled “Loss function Calculations.ipnyb”

Parameters
  • x (array like observation.) –

  • mu (mean or prediction.) –

  • k (overdispersion parameter (variance = mean(1+mean/k)). Note some notation uses $lpha$, ($k=lpha^{-1}$).) –

  • log (if True the natural log of the pmf is given.) –

  • See – Bolker, B. M. (2008). Negative Binomial. In Ecological Models in R (pp. 124–126). Princeton University Press. File “Loss function Calculations.ipnyb”

Returns

  • log pmf

  • math (mathcalp(x; mu,k)) = exp(ln(frac{Gamma left(k+xright)}{Gamma left(kright)x!}(frac{k}{k+mu})^{k}(frac{mu}{k+mu})^{x})))

pygom.utilR.pbinom(q, size, prob, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Binomial.html

pygom.utilR.pchisq(x, df, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Chisquare.html

pygom.utilR.pexp(q, rate=1.0, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Exponential.html

pygom.utilR.pgamma(q, shape, rate=1.0, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/GammaDist.html

pygom.utilR.pnbinom(q, size, prob, mu, lower_tail=True, log=True)[source]#

See https://stat.ethz.ch/R-manual/R-devel/library/stats/html/NegBinomial.html

pygom.utilR.pnorm(q, mean=0, sd=1, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Normal.html

pygom.utilR.ppois(q, mu=1.0, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Poisson.html

pygom.utilR.punif(q, min=0.0, max=1.0, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Uniform.html

pygom.utilR.qbeta(p, shape1, shape2)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Beta.html

pygom.utilR.qbinom(q, size, prob)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Binomial.html

pygom.utilR.qchisq(p, df)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Chisquare.html

pygom.utilR.qexp(p, rate=1.0)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Exponential.html

pygom.utilR.qgamma(q, shape, rate=1.0)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/GammaDist.html

pygom.utilR.qnbinom(p, size, prob, mu, lower_tail=True, log=True)[source]#

See https://stat.ethz.ch/R-manual/R-devel/library/stats/html/NegBinomial.html

pygom.utilR.qnorm(p, mean=0, sd=1)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Normal.html

pygom.utilR.qpois(q, mu=1.0, log=False)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Poisson.html

pygom.utilR.qunif(p, min=0.0, max=1.0)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Uniform.html

pygom.utilR.rbeta(n, shape1, shape2, seed=None)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Beta.html

pygom.utilR.rbinom(n, size, prob, seed=None)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Binomial.html

@param seed represent which type of seed to use. None or False uses the default seed. When seed is an integer number, it will reset the seed via numpy.random.seed. When seed=True, then a numpy.random.RandomState object will be used. If seed is an object of numpy.random.RandomState then it will be used directly

pygom.utilR.rchisq(n, df, seed=None)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Chisquare.html

@param seed represent which type of seed to use. None or False uses the default seed. When seed is an integer number, it will reset the seed via numpy.random.seed. When seed=True, then a numpy.random.RandomState object will be used. If seed is an object of numpy.random.RandomState then it will be used directly

pygom.utilR.rexp(n, rate=1.0, seed=None)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Exponential.html

@param seed represent which type of seed to use. None or False uses the default seed. When seed is an integer number, it will reset the seed via numpy.random.seed. When seed=True, then a numpy.random.RandomState object will be used. If seed is an object of numpy.random.RandomState then it will be used directly

pygom.utilR.rgamma(n, shape, rate=1.0, seed=None)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/GammaDist.html

@param seed represent which type of seed to use. None or False uses the default seed. When seed is an integer number, it will reset the seed via numpy.random.seed. When seed=True, then a numpy.random.RandomState object will be used. If seed is an object of numpy.random.RandomState then it will be used directly

pygom.utilR.rmvnorm(n, mean, sigma, seed=None)[source]#

See https://www.rdocumentation.org/packages/mvtnorm/versions/1.0-12/topics/mvnorm

pygom.utilR.rnorm(n, mean=0, sd=1, seed=None)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Normal.html

@param seed represent which type of seed to use. None or False uses the default seed. When seed is an integer number, it will reset the seed via numpy.random.seed. When seed=True, then a numpy.random.RandomState object will be used. If seed is an object of numpy.random.RandomState then it will be used directly

pygom.utilR.rpois(n, mu=1.0, seed=None)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Poisson.html

@param seed represent which type of seed to use. None or False uses the default seed. When seed is an integer number, it will reset the seed via numpy.random.seed. When seed=True, then a numpy.random.RandomState object will be used. If seed is an object of numpy.random.RandomState then it will be used directly

pygom.utilR.runif(n, min=0.0, max=1.0, seed=None)[source]#

See https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Uniform.html

@param seed represent which type of seed to use. None or False uses the default seed. When seed is an integer number, it will reset the seed via numpy.random.seed. When seed=True, then a numpy.random.RandomState object will be used. If seed is an object of numpy.random.RandomState then it will be used directly

pygom.utilR.test_seed(seed)[source]#

Test the input type of seed and return a new random generator if appropriate.

Parameters

seed – If True, then a new numpy.random.RandomState will be created. If False, then a numpy.random.RandomState with the current global state of the random number generator is returned. If it is an int, then the input seed is used to create a new random state. If it is already a numpy.random.RandomState object then the same object is returned.

Return type

numpy.random.RandomState