JuliaBUGS.BUGSPrimitives.dnormFunction
dnorm(μ, τ)

Returns an instance of Normal with mean $μ$ and standard deviation $\frac{1}{√τ}$.

\[p(x|μ,τ) = \sqrt{\frac{τ}{2π}} e^{-τ \frac{(x-μ)^2}{2}}\]

source
JuliaBUGS.BUGSPrimitives.dlogisFunction
dlogis(μ, τ)

Return an instance of Logistic with location parameter $μ$ and scale parameter $\frac{1}{√τ}$.

\[p(x|μ,τ) = \frac{\sqrt{τ} e^{-\sqrt{τ}(x-μ)}}{(1+e^{-\sqrt{τ}(x-μ)})^2}\]

source
JuliaBUGS.BUGSPrimitives.dtFunction
dt(μ, τ, ν)

If $μ = 0$ and $σ = 1$, the function returns an instance of TDist with $ν$ degrees of freedom, location $μ$, and scale $σ = \frac{1}{\sqrt{τ}}$. Otherwise, it returns an instance of TDistShiftedScaled.

\[p(x|ν,μ,σ) = \frac{Γ((ν+1)/2)}{Γ(ν/2) \sqrt{νπσ}} \left(1+\frac{1}{ν}\left(\frac{x-μ}{σ}\right)^2\right)^{-\frac{ν+1}{2}}\]

source
JuliaBUGS.BUGSPrimitives.TDistShiftedScaledType
TDistShiftedScaled(ν, μ, σ)

Student's t-distribution with $ν$ degrees of freedom, location $μ$, and scale $σ$.

This struct allows for a shift (determined by $μ$) and a scale (determined by $σ$) of the standard Student's t-distribution provided by the Distributions.jl package.

pdf, logpdf, rand, minimum, and maximum are implemented for this distribution; the last three are what a model needs to initialize a parameter with this prior and to transform it to unconstrained space.

See Also

TDist

source
JuliaBUGS.BUGSPrimitives.dflatFunction
dflat()

Returns an instance of Flat or TruncatedFlat if truncated.

Flat represents a flat (uniform) prior over the real line, which is an improper distribution. And TruncatedFlat represents a truncated version of the Flat distribution.

Only pdf, logpdf, minimum, and maximum are implemented for these Distributions.

When use in a model, the parameters always need to be initialized.

source
JuliaBUGS.BUGSPrimitives.dweibFunction
dweib(a, b)

Returns an instance of Weibull distribution object with shape parameter $a$ and scale parameter $b^{-1/a}$.

BUGS parameterizes the Weibull by shape $a$ and "rate-like" $b$ (the density below), whereas Distributions.Weibull(α, θ) uses shape $α$ and scale $θ$ with density $\frac{α}{θ} (x/θ)^{α-1} e^{-(x/θ)^α}$. Matching the two gives $θ = b^{-1/a}$; the two agree with $θ = 1/b$ only when $a = 1$.

The Weibull distribution is a common model for event times. The hazard or instantaneous risk of the event is $abx^{a-1}$. For $a < 1$ the hazard decreases with $x$; for $a > 1$ it increases. $a = 1$ results in the exponential distribution with constant hazard.

\[p(x|a,b) = abx^{a-1}e^{-b x^a}\]

source
JuliaBUGS.BUGSPrimitives.dgevFunction
dgev(μ, σ, η)

Returns an instance of GeneralizedExtremeValue with location $μ$, scale $σ$, and shape $η$.

\[p(x|μ,σ,η) = \frac{1}{σ} \left(1 + η \frac{x - μ}{σ}\right)^{-\frac{1}{η} - 1} e^{-\left(1 + η \frac{x - μ}{σ}\right)^{-\frac{1}{η}}}\]

where $\frac{η(x - μ)}{σ} > -1$.

source
JuliaBUGS.BUGSPrimitives.dfFunction
df(n, m, μ=0, τ=1)

Returns an instance of F-distribution object with $n$ and $m$ degrees of freedom, location $μ$, and scale $τ$. This function is only valid when $μ = 0$ and $τ = 1$,

\[p(x|n, m, μ, τ) = \frac{\Gamma\left(\frac{n+m}{2}\right)}{\Gamma\left(\frac{n}{2}\right) \Gamma\left(\frac{m}{2}\right)} \left(\frac{n}{m}\right)^{\frac{n}{2}} \sqrt{τ} \left(\sqrt{τ}(x - μ)\right)^{\frac{n}{2}-1} \left(1 + \frac{n \sqrt{τ}(x-μ)}{m}\right)^{-\frac{n+m}{2}}\]

where $\frac{n \sqrt{τ} (x - μ)}{m} > -1$.

source
JuliaBUGS.BUGSPrimitives.dmnormFunction
dmnorm(μ::AbstractVector, T::AbstractMatrix)

Returns an instance of Multivariate Normal with mean vector μ and covariance matrix $T^{-1}$.

\[p(x|μ,T) = (2π)^{-k/2} |T|^{1/2} e^{-1/2 (x-μ)' T (x-μ)}\]

where $k$ is the dimension of x.

source
JuliaBUGS.BUGSPrimitives.dmtFunction
dmt(μ::AbstractVector, T::AbstractMatrix, k)

Returns an instance of Multivariate T with mean vector $μ$, scale matrix $T^{-1}$, and $k$ degrees of freedom.

\[p(x|k,μ,Σ) = \frac{\Gamma((k+d)/2)}{\Gamma(k/2) (k\pi)^{p/2} |Σ|^{1/2}} \left(1 + \frac{1}{k} (x-μ)^T Σ^{-1} (x-μ)\right)^{-\frac{k+p}{2}}\]

where $p$ is the dimension of $x$.

source
JuliaBUGS.BUGSPrimitives.dwishFunction
dwish(R::AbstractMatrix, k)

Returns an instance of Wishart with $k$ degrees of freedom and the scale matrix $T^{-1}$.

\[p(X|R,k) = |R|^{k/2} |X|^{(k-p-1)/2} e^{-(1/2) tr(RX)} / (2^{kp/2} Γ_p(k/2))\]

where $p$ is the dimension of $X$, and it should be less than or equal to $k$.

source
JuliaBUGS.BUGSPrimitives.ddirichFunction
ddirich(θ::AbstractVector)

Return an instance of Dirichlet with parameters $θ_i$.

\[p(x|θ) = \frac{Γ(\sum θ)}{∏ Γ(θ)} ∏ x_i^{θ_i - 1}\]

where $\theta_i > 0, x_i \in [0, 1], \sum_i x_i = 1$

source
JuliaBUGS.BUGSPrimitives.dbinFunction
dbin(p, n)

Returns an instance of Binomial with number of trials n and success probability p.

\[p(x|n,p) = \binom{n}{x} p^x (1 - p)^{n-x}\]

end

where $\theta \in [0, 1], n \in \mathbb{Z}^+,$ and $x = 0, \ldots, n$.

source
JuliaBUGS.BUGSPrimitives.dhyperFunction
dhyper(n₁, n₂, m₁, ψ=1)

Returns an instance of Hypergeometric. This distribution is used when sampling without replacement from a population consisting of $n₁$ successes and $n₂$ failures, with $m₁$ being the number of trials or the sample size. The function currently only allows for $ψ = 1$.

\[p(x | n₁, n₂, m₁, \psi) = \frac{\binom{n₁}{x} \binom{n₂}{m₁ - x} \psi^x}{\sum_{i=u_0}^{u_1} \binom{n1}{i} \binom{n2}{m₁ - i} \psi^i}\]

where $u_0 = \max(0, m₁-n₂), u_1 = \min(n₁,m₁),$ and $u_0 \leq x \leq u_1$

source