View source: R/CommonFunction.R
| GroupProb | R Documentation |
GroupProb calculates the posterior probability for each individual to belong to each of the latent groups, based on a fitted trajeR model.
GroupProb(Obj, Y, A, TCOV = NULL, X = NULL)
Obj |
A trajectory object returned by the |
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. |
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.
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])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.