Skip to contents

These are the pieces a declared non-normal random effect is built from (see the dist() line of an ini({}) block). The latent random effect stays standard normal, phiU() maps it to a uniform, and the family's inverse CDF maps that uniform to the random effect.

Usage

phiU(q)

ibeta(a, b, x)

ibetaDer(a, b, x)

ibetaInv(a, b, p)

ibetaDera(a, b, x)

ibetaDerb(a, b, x)

gammapDera(a, x)

studentTDen(x, nu)

studentTCdf(x, nu)

studentTCdfDnu(x, nu)

studentTInv(p, nu)

Arguments

q

normal deviate (phiU())

a

first shape parameter

b

second shape parameter

x

value at which the CDF (or its derivative) is taken

p

probability

nu

degrees of freedom

Value

numeric vector, recycled to the longest argument

Details

phiU() is phi() bounded away from 0 and 1 by 1e-15. phi() saturates to exactly 0 or 1 in double precision around |q| = 8.3, where an inverse CDF would return an infinity.

ibeta(), ibetaDer() and ibetaInv() are the regularized incomplete beta function, its derivative in x and its inverse – ie pbeta(), dbeta() and qbeta(). studentTCdf(), studentTDen() and studentTInv() are the Student t CDF, density and quantile, written on the incomplete beta so the quantile is exactly the inverse of the CDF at the same tolerance.

gammapDera(), ibetaDera(), ibetaDerb() and studentTCdfDnu() are the derivatives of those CDFs with respect to their SHAPE parameters. None has an elementary closed form, so they are central differences with one Richardson extrapolation. They exist so that rxode2's derivative table is complete for these functions: without them a model using an inverse CDF silently degrades to a one sided finite difference, which is precisely wrong in the tails.

Author

Matthew L. Fidler

Examples


phiU(c(-9, 0, 9))
#> [1] 1e-15 5e-01 1e+00

ibetaInv(2, 3, 0.5) ## == qbeta(0.5, 2, 3)
#> [1] 0.3857276

studentTInv(0.975, 6) ## == qt(0.975, 6)
#> [1] 2.446912