Tools for transforming between N(0,1) variables and other distributions in predictor expressions
Usage
bru_forward_transformation(qfun, x, ..., tail.split. = 0)
bru_inverse_transformation(pfun, x, ..., tail.split. = NULL)
Arguments
- qfun
A quantile function object, such as
qexp
- x
Values to be transformed
- ...
Distribution parameters passed on to the
qfun
andpfun
functions- tail.split.
For x-values larger than
tail.split.
, upper quantile calculations are used internally, and for smaller values lower quantile calculations are used. This can avoid lack of accuracy in the distribution tails. IfNULL
, forward calculations split at 0, and inverse calculations use lower tails only, potentially losing accuracy in the upper tails.- pfun
A CDF function object, such as
pexp
Value
For
bru_forward_transformation
, a numeric vector
For
bru_inverse_transformation
, a numeric vector
Examples
u <- rnorm(5, 0, 1)
y <- bru_forward_transformation(qexp, u, rate = 2)
v <- bru_inverse_transformation(pexp, y, rate = 2)
rbind(u, y, v)
#> [,1] [,2] [,3] [,4] [,5]
#> u 0.6525164 0.03750332 0.5551671 -0.4831030 1.697507
#> y 0.6792734 0.36176005 0.6199897 0.1888116 1.552769
#> v 0.6525164 0.03750332 0.5551671 -0.4831030 1.697507