Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

FLXMRmgcv

FlexMix Interface to GAMs


Description

This is a driver which allows fitting of mixtures of GAMs.

Usage

FLXMRmgcv(formula = . ~ ., family = c("gaussian", "binomial", "poisson"),
          offset = NULL, control = NULL, optimizer = c("outer", "newton"),
          in.out = NULL, eps = .Machine$double.eps, ...)

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.

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.

control

A list of fit control parameters returned by gam.control.

optimizer

An array specifying the numerical optimization method to use to optimize the smoothing parameter estimation criterion; for more details see gam.

in.out

Optional list for initializing outer iteration; for more details see gam.

eps

Observations with an a-posteriori probability smaller or equal to eps are omitted in the M-step.

...

Additional arguments to be pased to the GAM fitter.

Value

Returns an object of class FLXMRmgcv.

Author(s)

Bettina Gruen

See Also

Examples

set.seed(2012)
x <- seq(0, 1, length.out = 100)
z <- sample(0:1, length(x), replace = TRUE)
y <- rnorm(length(x), ifelse(z, 5 * sin(x * 2 * pi), 10 * x - 5))
fitted_model <- flexmix(y ~ s(x), model = FLXMRmgcv(),
                        cluster = z + 1,
                        control = list(tolerance = 10^-3))
plot(y ~ x, col = clusters(fitted_model))
matplot(x, fitted(fitted_model), type = "l", add = TRUE)

flexmix

Flexible Mixture Modeling

v2.3-17
GPL (>= 2)
Authors
Bettina Gruen [aut, cre] (<https://orcid.org/0000-0001-7265-4773>), Friedrich Leisch [aut] (<https://orcid.org/0000-0001-7278-1983>), Deepayan Sarkar [ctb] (<https://orcid.org/0000-0003-4107-1553>), Frederic Mortier [ctb], Nicolas Picard [ctb] (<https://orcid.org/0000-0001-5548-9171>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.