Learn R Programming

greta (version 0.2.0)

transforms: transformation functions for greta arrays

Description

transformations for greta arrays, which may also be used as inverse link functions. Also see operators and functions.

Usage

iprobit(x)

ilogit(x)

icloglog(x)

icauchit(x)

log1pe(x)

Arguments

x

a real-valued (i.e. values ranging from -Inf to Inf) greta array to transform to a constrained value

Details

greta does not allow you to state the transformation/link on the left hand side of an assignment, as is common in the BUGS and STAN modelling languages. That's because the same syntax has a very different meaning in R, and can only be applied to objects that are already in existence. The inverse forms of the common link functions (prefixed with an 'i') are therefore more likely to useful in modelling, and these are what are provided here.

The log1pe inverse link function is equivalent to log(1 + exp(x)), yielding a positive transformed parameter. Unlike the log transformation, this transformation is approximately linear for x > 1. i.e. when \(x > 1\), \(y \approx x\)

Examples

Run this code
# NOT RUN {
 x = normal(1, 3, dim = 10)

 # transformation to the unit interval
 p1 <- iprobit(x)
 p2 <- ilogit(x)
 p3 <- icloglog(x)
 p4 <- icauchit(x)

 # and to positive reals
 y <- log1pe(x)
# }

Run the code above in your browser using DataLab