Family representing a GLM with custom distribution and link function
Source:R/population.R
custom_family.Rd
Allows specification of the random component and link function for a response
variable. In principle this could be used to specify any GLM family, but it
is usually easier to use the predefined families, such as gaussian()
and
binomial()
.
Arguments
- distribution
The distribution of the random component. This should be in the form of a function taking one argument, the vector of values on the inverse link scale, and returning a vector of draws from the distribution.
- inverse_link
The inverse link function.
Details
A GLM is specified by a combination of:
Random component, i.e. the distribution that Y is drawn from
Link function relating the mean of the random component to the linear predictor
Linear predictor
Using custom_family()
we can specify the random component and link
function, while the linear predictor is set in population()
when setting up
the population relationships. A family specified this way can be used to
specify a population (via population()
), but can't be used to estimate a
model (such as with glm()
).
See also
ols_with_error()
for the special case of linear regression with
custom error distribution