Learn R Programming

ClustMMDD (version 1.0.3)

isInFile.R: Find a model in a file.

Description

Find a given model defined by (K, S) in a file.

Usage

isInFile.R(K, S, file, header)

Arguments

K
The number of clusters.
S
A vector of logicals of length equal to the number of variables, that indicates the clustering variables.
file
A file where to find the model.
header
A logical indicating if the file contains a header or not.

Value

  • A list :
    • TrueFalse :
    {A logical indicating if the given model was found and the following if TRUE.}
  • line :The line where the given is in the file.
  • N :The size of the dataset from which the model was estimated.
  • logLik :The log-likelihood.
  • dim :The dimension of the model = number of free parameters.
  • entropy :The entropy associated to estimated parameters of the models.

References

  • http://projecteuclid.org/euclid.ejs/1379596773{Dominique Bontemps and Wilson Toussile (2013)} : Clustering and variable selection for categorical multivariate data. Electronic Journal of Statistics, Volume 7, 2344-2371, ISSN.
  • http://link.springer.com/article/10.1007%2Fs11634-009-0043-x{Wilson Toussile and Elisabeth Gassiat (2009)} : Variable selection in model-based clustering using multilocus genotype data. Adv Data Anal Classif, Vol 3, number 2, 109-134.

Examples

Run this code
data(genotype1)
head(genotype1) 
genotype2 = cutEachCol(genotype1[, -11], ploidy = 2)
head(genotype2)

S = c(rep(TRUE, 8), rep(FALSE, 2))
outPut = selectK.R(genotype2, S, Kmax = 6, ploidy = 2, Kmin=1)
isInFile.R(K = 5, S, "genotype2_ExploredModels.txt", header = TRUE)
isInFile.R(K = 5, rep(TRUE, 10), "genotype2_ExploredModels.txt", header = TRUE)

file.remove("genotype2_ExploredModels.txt")

Run the code above in your browser using DataLab