GroupProb: Calculate Posterior Membership Probabilities

View source: R/CommonFunction.R

GroupProbR Documentation

Calculate Posterior Membership Probabilities

Description

GroupProb calculates the posterior probability for each individual to belong to each of the latent groups, based on a fitted trajeR model.

Usage

GroupProb(Obj, Y, A, TCOV = NULL, X = NULL)

Arguments

Obj

A trajectory object returned by the trajeR function.

Y

Matrix. A real matrix. The data.

A

Matrix. A real matrix. The time variable.

TCOV

Matrix. Optional. A matrix containing the time-dependent covariates, if they were used in the model.

X

Matrix. Optional. A matrix of covariates that modify the group membership probability, if they were used in the model.

Value

A matrix of size n x ng (number of individuals by number of groups), where each entry [i, j] is the posterior probability of individual i belonging to group j.

Examples

data <- read.csv(system.file("extdata", "CNORM2gr.csv", package = "trajeR"))
data <- as.matrix(data)
sol <- trajeR(Y = data[, 2:6], A = data[, 7:11], degre = c(2, 2), Model = "CNORM", Method = "EM")
GroupProb(sol, Y = data[, 2:6], A = data[, 7:11])

trajeR documentation built on Aug. 4, 2026, 1:09 a.m.