Bootstrap a flexmix Object

Description

Given a flexmix object perform parametric or empirical bootstrap.

Usage

1
2
3
4
5
6
7
8
9
boot(object, ...)
## S4 method for signature '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 signature 'flexmix'
LR_test(object, R, alternative = c("greater", "less"), control, ...)

Arguments

object

A fitted finite mixture model of class flexmix.

R

The number of bootstrap replicates.

sim

A character string indicating the type of simulation required. Possible values are "ordinary" (the default), "parametric", or "empirical".

initialize_solution

A logical. If TRUE the EM algorithm is initialized in the given solution.

keep_weights

A logical. If TRUE the weights are kept.

keep_groups

A logical. If TRUE the groups are kept.

verbose

If a positive integer, then progress information is reported every verbose iterations. If 0, no output is generated during the bootstrap replications.

control

Object of class FLXcontrol or a named list. If missing the control of the fitted object is taken.

k

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.

alternative

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.

model

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.

Value

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.

Author(s)

Bettina Gruen

Examples

1
2
3
4
5
6
7
data("NPreg", package = "flexmix")
fitted <- initFlexmix(yn ~ x + I(x^2) | id2, data = NPreg, k = 2)
## Not run: 
lrtest <- LR_test(fitted, alternative = "greater", R = 20,
                  verbose = 1)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.