getCompletedData: Get the completed data from MixtComp object

View source: R/MIXTCOMP_getter.R

getCompletedDataR Documentation

Get the completed data from MixtComp object

Description

Get the completed data from MixtComp object (does not manage functional models)

Usage

getCompletedData(outMixtComp, var = NULL, with.z_class = FALSE)

Arguments

outMixtComp

object of class MixtCompLearn or MixtComp obtained using mixtCompLearn or mixtCompPredict functions from RMixtComp package or rmcMultiRun from RMixtCompIO package.

var

Name of the variables for which to extract the completed data. Default is NULL (all variables are extracted)

with.z_class

if TRUE, z_class is returned with the data.

Value

a matrix with the data completed by MixtComp (z_class is in the first column and then variables are sorted in alphabetic order, it may differ from the original order of the data).

Author(s)

Quentin Grimonprez

See Also

Other getter: getBIC(), getEmpiricTik(), getMixtureDensity(), getParam(), getPartition(), getType()

Examples

if (requireNamespace("RMixtCompIO", quietly = TRUE)) {
  dataLearn <- list(
    var1 = as.character(c(rnorm(50, -2, 0.8), rnorm(50, 2, 0.8))),
    var2 = as.character(c(rnorm(50, 2), rpois(50, 8)))
  )

  # add missing values
  dataLearn$var1[12] <- "?"
  dataLearn$var2[72] <- "?"

  model <- list(
    var1 = list(type = "Gaussian", paramStr = ""),
    var2 = list(type = "Poisson", paramStr = "")
  )

  algo <- list(
    nClass = 2,
    nInd = 100,
    nbBurnInIter = 100,
    nbIter = 100,
    nbGibbsBurnInIter = 100,
    nbGibbsIter = 100,
    nInitPerClass = 3,
    nSemTry = 20,
    confidenceLevel = 0.95,
    ratioStableCriterion = 0.95,
    nStableCriterion = 10,
    mode = "learn"
  )

  resLearn <- RMixtCompIO::rmcMultiRun(algo, dataLearn, model, nRun = 3)

  # get completedData
  completedData <- getCompletedData(resLearn)
  completedData2 <- getCompletedData(resLearn, var = "var1")
}


RMixtCompUtilities documentation built on Sept. 22, 2023, 5:10 p.m.