R/link_invlink.R

Defines functions invlink link

Documented in invlink link

## Transformation of a variable from the observation scale to the link scale
link <- function(x, type = c("cloglog", "log", "logit")){
  switch(type,
    logit = qlogis(x),
    log = log(x),
    cloglog = log(-log(1 - x)))
    }

## Transformation of a variable from the link scale to the observation scale
invlink <- function(x, type = c("cloglog", "log", "logit")){
  switch(type,
    logit = plogis(x),
    log = exp(x),
    cloglog = 1 - exp( -exp(x)))
    }

Try the aod package in your browser

Any scripts or data that you put into this service are public.

aod documentation built on June 22, 2024, 12:21 p.m.