family
Generate a Family Object

Description

Generates a family object that contains a list of functions and expressions used by glm and gam.

Usage

family(object, ...) 
binomial(link = "logit") 
gaussian(link = "identity") 
Gamma(link = "inverse") 
inverse.gaussian(link = "1/mu^2") 
poisson(link = "log") 
quasi(link = "identity", variance = "constant")
quasibinomial(link = "logit")
quasipoisson(link = "log")
print.family(x, ...)

Arguments

link a character string that specifies the link function. You can type one of the following:
  • logit
  • probit
  • cloglog
  • identity
  • inverse
  • log
  • 1/mu^2
  • sqrt
  • cauchit

Not all links are suitable for all families. For more information, see the suitable pairings table in the Details section.

variance a character string that specifies the variance function to use with the quasi function. You can type one of the following:
  • constant
  • mu(1-mu)
  • mu
  • mu^2
  • mu^3
The variance argument is intended to use only with the quasi function. All of the other family functions have a variance function included and will return an error if you include the variance argument.
object any object from which a family object can be extracted. Typically, a fitted model object, with a default of gaussian.
x a family object.
... additional arguments passed on to other functions.

Details

Each of the functions named in the Usage section (except for quasi, the family extractor function family, and print.family) are associated with a member of the exponential family of distributions. As such, they have a fixed variance function. Typically, you can specify the link function to use, with the default corresponding to the canonical link for that family. The quasi name represents Quasi-likelihood and the function does not require that you use a specific distribution; rather, you can combine quasi with any available link and variance function.
The following table summarizes the suitable pairings:
binomial gaussian Gamma inverse.gaussian poisson quasi quasibinomial quasipoisson
logit * * *
probit * * *
cloglog * * *
identity * * * * * *
inverse * * * *
log * * * * * * * *
1/mu^2 * *
sqrt * * *
cauchit * * *
If you use quasi, (power) can be used to generate a power link object.
You can construct custom families, as long as the families have compatible components and they have the same names as those of an existing family, for example, of binomial. We recommend that you construct a custom family by using quasi with custom link and variance objects. Alternative approaches are to use make.family or directly construct the family object.
When you pass the family as an argument to glm or gam with the default link, you can omit the empty parentheses ().
Value
returns a family object that is a list of functions and expressions used by glm and gam in their iteratively re-weighted least-squares algorithms. For more information see family.object.
The family() function extracts a family object from any other object that contains a family. family() is generic and calls one of two methods: family.lm or family.glm.
The print.family() function is a print method for the class "family". It returns the item family from x is output as "Family" and item link from x is output as "Link function".
See Also
GAMMA, gamma, family.object, gam, glm, power, make.link.
Examples
x <- log2(1:20)
n <- 11:30
y <- sin(1:20) > 0.5
glm(y ~ x, family = binomial)  
glm(n ~ x, family = quasipoisson(link = "log"))
Package stats version 6.0.0-69
Package Index