Lapply-methods.RdApply a function to each component of a finite mixture
# S4 method for class 'FLXRmstep'
Lapply(object, FUN, model = 1, component = TRUE, ...)Apply a function to each component of a
refitted flexmix object using method = "mstep".
FUN is found by a call to match.fun and typically is specified
as a function or a symbol (e.g. a backquoted name) or a character
string specifying a function to be searched for from the
environment of the call to Lapply.
A list of the length equal to the number of components specified is
returned, each element of which is the result of applying FUN to the
specified component of the refitted mixture model.
data("NPreg", package = "flexmix")
ex2 <- flexmix(yn ~ x, data = NPreg, k = 2, model = list(FLXMRglm(yn ~
. + I(x^2)), FLXMRglm(yp ~ ., family = "poisson")))
ex2r <- refit(ex2, method = "mstep")
Lapply(ex2r, "vcov", 2)
#> $Comp.1
#> (Intercept) x
#> (Intercept) 0.007647596 -0.0013625074
#> x -0.001362507 0.0003998588
#>
#> $Comp.2
#> (Intercept) x
#> (Intercept) 0.012693403 -0.0018157355
#> x -0.001815736 0.0003136609
#>