Extract link and inverse link functions from models
Returns the link or its inverse from an estimated model, and provides a simple way to extract these functions from complex models with multiple links, such as location scale models.
link(object, ...) ## S3 method for class 'family' link(object, parameter = NULL, which_eta = NULL, ...) ## S3 method for class 'gam' link(object, parameter = NULL, which_eta = NULL, ...) ## S3 method for class 'bam' link(object, parameter = NULL, which_eta = NULL, ...) ## S3 method for class 'gamm' link(object, ...) ## S3 method for class 'glm' link(object, ...) ## S3 method for class 'list' link(object, ...) inv_link(object, ...) ## S3 method for class 'family' inv_link(object, parameter = NULL, which_eta = NULL, ...) ## S3 method for class 'gam' inv_link(object, parameter = NULL, which_eta = NULL, ...) ## S3 method for class 'bam' inv_link(object, parameter = NULL, which_eta = NULL, ...) ## S3 method for class 'gamm' inv_link(object, ...) ## S3 method for class 'list' inv_link(object, ...) ## S3 method for class 'glm' inv_link(object, ...) extract_link(family, ...) ## S3 method for class 'family' extract_link(family, inverse = FALSE, ...) ## S3 method for class 'general.family' extract_link(family, parameter, inverse = FALSE, which_eta = NULL, ...)
object |
a family object or a fitted model from which to extract the
family object. Models fitted by |
... |
arguments passed to other methods. |
parameter |
character; which parameter of the distribution. Usually
|
which_eta |
numeric; the linear predictor to extract for families
|
family |
a family object, the result of a call to |
inverse |
logical; return the inverse of the link function? |
Gavin L. Simpson
load_mgcv() link(gaussian()) link(nb()) inv_link(nb()) dat <- gamSim(1, n = 400, dist = "normal", scale = 2, verbose = FALSE) mod <- gam(list(y ~ s(x0) + s(x1) + s(x2) + s(x3), ~ 1), data = dat, family = gaulss) link(mod, parameter = "scale") inv_link(mod, parameter = "scale") ## Works with `family` objects too link(shash(), parameter = "skewness")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.