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 April 2, 2022, 9:05 a.m.