Enrich objects of class family
Description
Enrich objects of class family
with familyspecific
mathematical functions
Usage
1 2 
Arguments
object 
an object of class 
with 
a character vector with the names of the components to
enrich 
... 
extra arguments to be passed to the 
Details
family
objects specify the details of the models used
by functions such as glm
. The families
implemented in the stats
package include
binomial
, gaussian
,
Gamma
, inverse.gaussian
,
and poisson
. family
objects specify particular characteristics of distributions from
the exponential family. Such distributions 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) + c_2(y))
where m > 0 is an observation weight, and a(.), b(.), c_1(.) and c_2(.) are sufficiently smooth, realvalued functions.
The expected value and the variance of such distributions is mu = b'(theta) and phi * V(mu)/m, respectively, where V(mu) is called the variance function. The parameter phi is called a dispersion parameter.
Characteristics of the exponential family that are already
implemented in family
objects include:

variance
: V(.) 
dev.resids
: 2(y c_1'(mu)  y c_1'(y)  b(c'(mu)) + b(c'(y))) 
aic
: 2*sum(log f(y, theta, phi)) + 2*delta where delta is1
if the family has a dispersion parameter and0
else
The quasi
families differ from the other families in
that the variance function is not determined by the family but may
be supplied by the user. Also, the quasibinomial
and
quasipoisson
families differ from the
binomial
and poisson
families only in
that the dipsersion parameter is estimated to account for
overdispersion.
For quasi
, dev.resid
is m*(y  mu)^2 . For quasibinomial
and
quasipoisson
, dev.resid
is the same as
for quasibinomial
and
quasipoisson
, respectively. The aic
is
NA
for all quasi
families. See
quasi
for more details.
The enrich
method can enrich family
family
objects with extra characteristics of the family and of the chosen
link function. See enrich.linkglm
for the enrichment
of linkglm
objects.
Value
The object object
of class family
with
extra components. get_enrichment_options.family()
returns the components and their descriptions.
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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.