enrich.family: Enrich objects of class 'family'

Description Usage Arguments Details Value See Also Examples

Description

Enrich objects of class family with family-specific mathematical functions

Usage

1
2
## S3 method for class 'family'
enrich(object, with = "all", ...)

Arguments

object

an object of class family

with

a character vector with enrichment options for object

...

extra arguments to be passed to the compute_* functions

Details

family objects specify characteristics of the models used by functions such as glm. The families implemented in the stats package include binomial, gaussian, Gamma, inverse.gaussian, and poisson, which are all special cases of the exponential family of distributions that have probability mass or density function of the form

f(y, theta, phi) = exp((y * theta - b(theta) - c_1(y))/(phi/m) - a(-m/phi)/2 + c_2(y))

where m > 0 is an observation weight, and a(.), b(.), c_1(.) and c_2(.) are sufficiently smooth, real-valued functions.

The current implementation of family objects includes the variance function (variance), the deviance residuals (dev.resids), and the Akaike information criterion (aic). See, also family.

The enrich method can further enrich exponential family distributions with theta in terms of mu (theta), the functions b(theta) (bfun), c_1(y) (c1fun), c_2(y) (c2fun), a(zeta) (fun), the first two derivatives of V(mu) (d1variance and d2variance, respectively), and the first four derivatives of a(zeta) (d1afun, d2afun, d3afun, d4afun, respectively).

Corresponding enrichment options are also avaialble for quasibinomial, quasipoisson and wedderburn families.

The quasi families are enriched with d1variance and d2variance.

See enrich.link-glm for the enrichment of link-glm objects.

Value

The object object of class family with extra components. get_enrichment_options.family() returns the components and their descriptions.

See Also

enrich.link-glm, make.link

Examples

1
2
3
4
5
6
7
8
9
## An example from ?glm to illustrate that things still work with
## enriched families
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
print(d.AD <- data.frame(treatment, outcome, counts))
glm.D93 <- glm(counts ~ outcome + treatment, family = enrich(poisson()))
anova(glm.D93)
summary(glm.D93)

enrichwith documentation built on Jan. 11, 2020, 9:21 a.m.