Skip to contents

family() returns the R family() object of a fit: gaussian() for lmm() fits and the GLMM family (with its link) for glmm() fits. For negative-binomial fits it is MASS::negative.binomial(theta) at the fitted (or fixed) theta, like lme4::glmer.nb(); when MASS is not installed an equivalent family object with the same variance, deviance and link functions is returned.

Usage

# S3 method for class 'mm_lmm'
family(object, ...)

# S3 method for class 'mm_glmm'
family(object, ...)

# S3 method for class 'mm_lmm'
weights(object, type = c("prior", "working"), ...)

# S3 method for class 'mm_glmm'
weights(object, type = c("prior", "working"), ...)

Arguments

object

A fitted mm_lmm or mm_glmm object.

...

Unused.

type

"prior" or "working" (GLMMs only).

Value

A family object, or a numeric vector of weights.

Details

weights() mirrors lme4:::weights.merMod(): type = "prior" returns the prior weights, a vector of ones when the model was fitted without weights; type = "working" returns the final PIRLS working weights of a GLMM.

Examples

set.seed(1)
df <- data.frame(y = rnorm(60), x = rnorm(60),
                 g = factor(rep(seq_len(10), each = 6)))
fit <- lmm(y ~ x + (1 | g), df, control = mm_control(verbose = -1))
family(fit)
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
head(weights(fit))
#> [1] 1 1 1 1 1 1