Skip to contents

Transforms of a random effect eta with an estimated shape parameter, used as cl <- tcl*exp(etaBoxCox(eta.cl, lambda)) (Petersson et al. 2009). Each keeps eta = 0 at 0 and the rank order of eta, and has a shape giving the identity, so the shape can be tested with a likelihood ratio test. etaBoxCox() is (exp(eta)^lambda - 1)/lambda, which is eta at lambda = 0 and skews the distribution (roughly lambda in (-3, 3)). etaJohnDraper() is the modulus transform sign(eta)*((abs(eta) + 1)^lambda - 1)/lambda, the identity at lambda = 1, which changes the tails symmetrically. etaYeoJohnson() is ((eta + 1)^lambda - 1)/lambda for eta >= 0 and -((1 - eta)^(2 - lambda) - 1)/(2 - lambda) below, the identity at lambda = 1, which skews. etaHeavyTail() is eta*abs(eta)^theta (Petersson's heavy-tailed transform), the identity at theta = 0, with heavier tails for theta > 0 and a symmetric bimodal shape for theta in (-1, 0). etaLogit() is Petersson's logit transform (expit(logit(theta1) + eta) - theta1)*theta2 (theta1 in (0, 1) sets the skewness, theta2 > 0 the width; it is near the identity for theta1 = 0.5, theta2 = 4). etaSinhAsinh() is the sinh-arcsinh transform of Jones and Pewsey, centered so eta = 0 stays at 0, sinh(delta*asinh(eta) - eps) + sinh(eps); eps sets the skewness and delta > 0 the tails (heavier above 1), the identity at eps = 0, delta = 1. etaTukeyGH() is Tukey's g-and-h transform (exp(g*eta) - 1)/g*exp(h*eta^2/2); g sets the skewness and h >= 0 the tails, the identity at g = 0, h = 0. exprelD(z, n) is the n-th derivative of (exp(z) - 1)/z; it keeps every derivative exact through a shape of 0. absPowLog(x, p, k) is abs(x)^p*log(abs(x))^k with its limit at x = 0, the derivative helper of etaHeavyTail(). In a model, named arguments are matched and expanded into the positional call, eg etaBoxCox(lambda = lcl, eta = eta.cl).

Usage

etaBoxCox(eta, lambda)

etaJohnDraper(eta, lambda)

exprelD(z, n)

etaYeoJohnson(eta, lambda)

etaHeavyTail(eta, theta)

etaLogit(eta, theta1, theta2)

etaSinhAsinh(eta, eps = 0, delta = 1)

etaTukeyGH(eta, g = 0, h = 0)

absPowLog(x, p, k)

Arguments

eta

random effect

lambda

shape parameter

z

value of z

n

derivative order (non-negative integer)

theta

heavy-tail shape parameter

theta1

logit skewness parameter, in (0, 1)

theta2

logit width parameter, positive

eps

sinh-arcsinh skewness parameter

delta

sinh-arcsinh tail parameter, positive

g

Tukey g (skewness) parameter

h

Tukey h (tail) parameter, non-negative

x

value of x

p

power

k

power of the log

Value

numeric vector, recycled to the longest argument

References

Petersson KJ, Hanze E, Savic RM, Karlsson MO. Semiparametric distributions with estimated shape parameters. Pharm Res. 2009; 26(9):2174-85.

Jones MC, Pewsey A. Sinh-arcsinh distributions. Biometrika. 2009; 96(4):761-80.

Author

Matthew L. Fidler

Examples

etaBoxCox(c(-1, 0, 1), 0.5)
#> [1] -0.7869387  0.0000000  1.2974425
etaBoxCox(c(-1, 0, 1), 0) ## identity
#> [1] -1  0  1
etaJohnDraper(c(-1, 0, 1), 1) ## identity
#> [1] -1  0  1
etaYeoJohnson(c(-1, 0, 1), 1) ## identity
#> [1] -1  0  1
etaHeavyTail(c(-1, 0, 1), 0.5)
#> [1] -1  0  1
etaLogit(c(-1, 0, 1), 0.5, 4)
#> [1] -0.9242343  0.0000000  0.9242343
etaSinhAsinh(c(-1, 0, 1), 0, 1) ## identity
#> [1] -1  0  1
etaTukeyGH(c(-1, 0, 1), 0, 0) ## identity
#> [1] -1  0  1
exprelD(0, 0:3)
#> [1] 1.0000000 0.5000000 0.3333333 0.2500000