Learn R Programming

bgmm (version 1.8.5)

chooseModels: Selecting a subset of fitted models

Description

The function chooseModels extracts a sublist of models that match constraints on the number of components or on the model structure. The function chooseOptimal returns the model which is the best according the given model selection criteria.

Usage

chooseModels(models, kList = NULL, struct = NULL)

chooseOptimal(models, penalty=2, ...)

Arguments

models

an object of the class mModelList which represents a list of fitted models.

kList

a vector which specifies the requested numbers of Gaussian components (constraints on the number of components).

struct

a vector which specifies four letter abbreviations of names of the requested model structures (constraints on the model structure).

penalty

a penalty parameter in the GIC criteria. This parameter can be a single number or a string, either "BIC" or "AIC".

...

other arguments that will be passed to the getGIC function.

Value

An object of the class mModelList or mModel.

Details

The function chooseModels() extracts a sublist of models from the models argument. The returned sublist is also an object of the class mModelList and is composed of models that simultaneously satisfy the restrictions of the number of Gaussian components defined by kList and restrictions of the model structure defined by struct. If the argument kList is set to NULL then no restrictions of the number of components are applied, same with the argument struct.

The function chooseOptimal() returns an object of the class mModel which is the single model that has the best (smallest) GIC score.

References

Przemyslaw Biecek, Ewa Szczurek, Martin Vingron, Jerzy Tiuryn (2012), The R Package bgmm: Mixture Modeling with Uncertain Knowledge, Journal of Statistical Software.

Examples

Run this code
# NOT RUN {
 simulated = simulateData(d=2, k=3, n=100, m=50, cov="0", within="E", n.labels=2)
 
 models3 = beliefList(X=simulated$X, knowns=simulated$knowns, B=simulated$B,
               kList=2:4, mean="D", within="D")
 plotGIC(models3, penalty="BIC")

## Do not run
## It could take more than one minute
# simulated = simulateData(d=2, k=3, n=300, m=60, cov="0", within="E", n.labels=2)
# 
# models3 = beliefList(X=simulated$X, knowns=simulated$knowns, B=simulated$B,
#               kList=2:7, mean="D")
# plotGIC(models3, penalty="BIC")
#
# models4 = chooseModels(models3, kList=2:5, struct=c("DDDD","DDED","DDE0"))
# plot(models4)
# plotGIC(models4, penalty="BIC")
#
# model4 = chooseOptimal(models3, "BIC")
# plot(model4)
# }

Run the code above in your browser using DataLab