Refits an estimated flexmix model to obtain additional information like coefficient significance p-values for GLM regression.
# S4 method for flexmix
refit(object, newdata, method = c("optim",
"mstep"), ...)
# S4 method for FLXRoptim
summary(object, model = 1, which = c("model",
"concomitant"), ...)
# S4 method for FLXRmstep
summary(object, model = 1, which = c("model",
"concomitant"), ...)# S4 method for FLXRoptim,missing
plot(x, y, model = 1, which = c("model", "concomitant"),
bycluster = TRUE, alpha = 0.05, components, labels = NULL,
significance = FALSE, xlab = NULL, ylab = NULL, ci = TRUE,
scales = list(), as.table = TRUE, horizontal = TRUE, ...)
An object inheriting form class FLXR
is returned. For the
method using optim
the object has class FLXRoptim
and
for the M-step method it has class FLXRmstep
. Both classes give
similar results for their summary
methods.
Objects of class FLXRoptim
have their own plot
method.
Lapply
can be used to further analyse the refitted component
specific models of objects of class FLXRmstep
.
An object of class "flexmix"
Optional new data.
Specifies if the variance covariance matrix is
determined using optim
or if the posteriors are
assumed as given and an M-step is performed.
The model (for a multivariate response) that shall be used.
Specifies if a component specific model or the concomitant variable model is used.
An object of class "FLXRoptim"
Missing object.
A logical if the parameters should be group by cluster or by variable.
Numeric indicating the significance level.
Numeric vector specifying which components are plotted. The default is to plot all components.
Character vector specifying the variable names used.
A logical indicating if non-significant coefficients are shaded in a lighter grey.
String for the x-axis label.
String for the y-axis label.
A logical indicating if significant and insignificant parameter estimates are shaded differently.
See argument of the same name for
function xyplot
.
See arguments of the same name for
function xyplot
.
See arguments of the same name for
function xyplot
.
Currently not used
Friedrich Leisch and Bettina Gruen
For method = "mstep"
the standard deviations are determined
separately for each of the components using the a-posteriori
probabilities as weights without accounting for the fact that the
components have been simultaneously estimated. The derived standard
deviations are hence approximative and should only be used in an
exploratory way, as they are underestimating the uncertainty given
that the missing information of the component memberships are replaced
by the expected values.
The newdata
argument can only be specified when using
method = "mstep"
for refitting FLXMRglm
components. A
variant of glm
for weighted ML estimation is used for fitting
the components and full glm
objects are returned. Please note
that in this case the data and the model frame are stored for each
component which can significantly increase the object size.
The refit
method for FLXMRglm
models in
combination with the summary
method can be
used to obtain the usual tests for significance of coefficients. Note
that the tests are valid only if flexmix
returned the maximum
likelihood estimator of the parameters. If refit
is used with
method = "mstep"
for these component specific models the
returned object contains a glm
object for each component where
the elements model
which is the model frame and data
which contains the original dataset are missing.
Friedrich Leisch. FlexMix: A general framework for finite mixture models and latent class regression in R. Journal of Statistical Software, 11(8), 2004. doi:10.18637/jss.v011.i08
data("NPreg", package = "flexmix")
ex1 <- flexmix(yn ~ x + I(x^2), data = NPreg, k = 2)
ex1r <- refit(ex1)
## in one component all coefficients should be highly significant,
## in the other component only the linear term
summary(ex1r)
Run the code above in your browser using DataLab