Learn R Programming

flexmix (version 2.0-1)

FLXMRglmfix: FlexMix Interface to Generalized Linear Models with fixed coefficients

Description

This implements a driver for FlexMix which interfaces the glm family of models and where it is possible to specify fixed effects or nested varying effects for the coefficients or to ensure that in the Gaussian case the variance estimate is equal for all components.

Usage

FLXMRglmfix(formula = . ~ ., fixed=~0, varFix = FALSE, nested = NULL,
       family = c("gaussian", "binomial", "poisson", "Gamma"),
       offset = NULL)

Arguments

formula
A formula which is interpreted relative to the formula specified in the call to flexmix using update.formula. Default is to use the original flexmix model formula.
fixed
A formula which specifies the additional regressors for the fixed effects.
varFix
A logical indicating if the variance estimate for Gaussian components should be constrained to be equal for all components. It can be also a vector specifying the number of components with equal variance.
nested
An object of class FLXnested or a list specifying the nested structure.
family
A character string naming a glm family function.
offset
This can be used to specify an a priori known component to be included in the linear predictor during fitting.

Value

  • Returns an object of class FLXMRglmfix.

See Also

FLXMRglm

Examples

Run this code
data("NPreg")
ex <- flexmix(yn~x|id2, data=NPreg, k=2,
              model=FLXMRglm(yn~.+I(x^2)))
ex.fix <- flexmix(yn~x|id2, data = NPreg, 
                  model=FLXMRglmfix(nested = list(k = c(1,1),
                                    formula = c(~0, ~I(x^2)))))
summary(refit(ex))
summary(refit(ex.fix))

Run the code above in your browser using DataLab