get_MEDseq_results: Extract results from a MEDseq model

View source: R/Functions.R

get_MEDseq_resultsR Documentation

Extract results from a MEDseq model

Description

Utility function for extracting results of submodels from "MEDseq" objects when a range of models were run via MEDseq_fit.

Usage

get_MEDseq_results(x,
                   what = c("z", "MAP", "DBS", "ASW"), 
                   rank = 1L, 
                   criterion = c("bic", "icl", "aic", "dbs", 
                                 "asw", "cv", "nec", "loglik"), 
                   G = NULL, 
                   modtype = NULL, 
                   noise = TRUE, 
                   ...)

Arguments

x

An object of class "MEDseq" generated by MEDseq_fit or an object of class "MEDseqCompare" generated by MEDseq_compare.

what

A character string indicating the desired results to extract.

rank

A number indicating what rank model results should be extracted from, where the rank is determined by criterion. Defaults to 1, i.e. the best model.

criterion

The criterion used to determine the ranking. Defaults to "bic".

G

Optional argument giving the number of components in the model for which results are desired. Can be supplied with or without also specifying modtype.

modtype

Optional argument giving the desired model type for which results are desired. Can be supplied with or without also specifying G.

noise

A logical indicating whether models with a noise component should be considered. Defaults to TRUE.

...

Catches unused arguments.

Details

The arguments rank and criterion are invoked when one or more of the arguments G and modtype are missing. Thus, supplying G and modtype allows rank and criterion to be bypassed entirely.

Value

The desired results extracted from the MEDseq model.

Note

Arguments to this function can be supplied to plot.MEDseq via the ... construct.

Author(s)

Keefe Murphy - <keefe.murphy@mu.ie>

See Also

MEDseq_fit, plot.MEDseq

Examples

data(biofam)
# mod <- MEDseq_fit(seqdef(biofam[10:25] + 1L), G=9:10)

# Extract the MAP clustering of the best 9-cluster model according to the asw criterion
# get_MEDseq_results(mod, what="MAP", G=9, criterion="asw")

# Extract the DBS values of the best UUN model according to the dbs criterion
# get_MEDseq_results(mod, what="DBS", modtype="UUN", criterion="dbs")

# Plot the DBS values of this same model, by passing get_MEDseq_results arguments through plot
# plot(mod, type="dbsvals", modtype="UUN", criterion="dbs")

MEDseq documentation built on Dec. 28, 2022, 2:35 a.m.