Given a flexmix
object perform parametric or empirical bootstrap.
boot(object, ...)
# S4 method for flexmix
boot(object, R, sim = c("ordinary", "empirical", "parametric"),
initialize_solution = FALSE, keep_weights = FALSE,
keep_groups = TRUE, verbose = 0, control,
k, model = FALSE, ...)
LR_test(object, ...)
# S4 method for flexmix
LR_test(object, R, alternative = c("greater", "less"), control, ...)
boot
returns an object of class FLXboot
which
contains the fitted parameters, the fitted priors, the log
likelihoods, the number of components of the fitted mixtures and the
information if the EM algorithm has converged.
LR_test
returns an object of class htest
containing the
number of valid bootstrap replicates, the p-value, the - twice log
likelihood ratio test statistics for the original data and the
bootstrap replicates.
A fitted finite mixture model of class flexmix
.
The number of bootstrap replicates.
A character string indicating the type of simulation
required. Possible values are "ordinary"
(the default),
"parametric"
, or "empirical"
.
A logical. If TRUE
the EM algorithm is
initialized in the given solution.
A logical. If TRUE
the weights are kept.
A logical. If TRUE
the groups are kept.
If a positive integer, then progress information
is reported every verbose
iterations. If 0,
no output is generated during the bootstrap replications.
Object of class FLXcontrol
or a named list.
If missing the control of the fitted object
is taken.
Vector of integers specifying for which number of components
finite mixtures are fitted to the bootstrap samples. If missing the
number of components of the fitted object
are taken.
A character string specifying the alternative
hypothesis, must be either "greater"
(default) or
"less"
indicating if the alternative hypothesis is that the
mixture has one more component or one less.
A logical. If TRUE
the model and the weights slot for
each sample are stored and returned.
Further arguments to be passed to or from methods.
Bettina Gruen
data("NPreg", package = "flexmix")
fitted <- initFlexmix(yn ~ x + I(x^2) | id2, data = NPreg, k = 2)
if (FALSE) {
lrtest <- LR_test(fitted, alternative = "greater", R = 20,
verbose = 1)
}
Run the code above in your browser using DataLab