getEmpiricTik: Get the tik

View source: R/MIXTCOMP_getter.R

getEmpiricTikR Documentation

Get the tik

Description

Get the a posteriori probability to belong to each class for each individual

Usage

getEmpiricTik(outMixtComp)

getTik(outMixtComp, log = TRUE)

Arguments

outMixtComp

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

log

if TRUE, log(tik) are returned

Details

getTik returns a posteriori probabilities computed with the returned parameters. getEmpiricTik returns an estimation based on the sampled z_i during the algorithm.

Value

a matrix containing the tik for each individual (in row) and each class (in column).

Author(s)

Quentin Grimonprez

See Also

heatmapTikSorted

Other getter: getBIC(), getCompletedData(), 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)))
  )

  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 tik
  tikEmp <- getEmpiricTik(resLearn)
  tik <- getTik(resLearn, log = FALSE)
}


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