flexmix
object perform parametric or empirical bootstrap.boot(object, ...)
## S3 method for class '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, ...)
## S3 method for class 'flexmix':
LR_test(object, R, alternative = c("greater", "less"), control, ...)
flexmix
."ordinary"
(the default),
"parametric"
, or "empirical"
.TRUE
the EM algorithm is
initialized in the given solution.TRUE
the weights are kept.TRUE
the groups are kept.verbose
iterations. If 0,
no output is generated during the bootstrap replications.FLXcontrol
or a named list.
If missing the control of the fitted object
is taken.object
are taken."greater"
(default) or
"less"
indicating if the alternative hypothesis is that the
mixture has one more component or one less.TRUE
the model and the weights slot for
each sample are stored and returned.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.
data("NPreg", package = "flexmix")
fitted <- initFlexmix(yn ~ x + I(x^2) | id2, data = NPreg, k = 2)
lrtest <- LR_test(fitted, alternative = "greater", R = 20,
verbose = 1)
Run the code above in your browser using DataLab