transition_matrix_clcm: Transition Matrix

View source: R/transition_matrix_clcm.R

transition_matrix_clcmR Documentation

Transition Matrix

Description

Compute Transition Matrix, stratified on categorical variable Key to evaluating group differences

Usage

transition_matrix_clcm(
  mod,
  eap.classification = F,
  threshold = NULL,
  modal.classification = F,
  stratification = F,
  covariate = NULL
)

Arguments

mod

estimated model object from clcm() function. Note that if estimating the transition matrix stratified on a covariate, that (categorical) covariate must be part of the dataframe (dat) that was used to estimate the model, i.e., mod$dat must contain the covariate

eap.classification

select if expected a priori (EAP) classification is desired If neither MAP nor EAP classification is selected, then sample-level averages will be computed for each latent class. That is, the probablistic classifications in the subject posterior distributions will be retained and averaged.

threshold

numeric value, if EAP classification is selected, must choose a threshold for classification as 1 versus 0 on each attribute (factor).

modal.classification

logical; classify subjects using modal a priori (MAP) classification?

stratification

logical; should the transition matrix be computed stratified on categorical covariate?

covariate

categorical variable, separate transition matrix estimated for each level of the variable. Note that if estimating the transition matrix stratified on a covariate, that (categorical) covariate must be part of the dataframe (dat) that was used to estimate the model, i.e., mod$dat must contain the covariate.

Value

Returns a 2^K by 2^k numeric matrix; if transition matrix is stratified on covariate, then returns a list of 2^K by 2^K numeric matrices.

Examples

## Not run: 

set.seed(3112021)
sim.dat <- simulate_clcm(N=200,
                          number.timepoints = 2,
                          item.type = rep('Ordinal', 5),
                          categories.j = rep(4, 5),
                          lc.prop = list('Time_1' = c(0.5, 0.5), 'Time_2' = c(0.5, 0.5)) )

mod <- clcm(dat = sim.dat$dat,
          item.type = sim.dat$item.type,
           item.names = sim.dat$item.names,
           Q = sim.dat$Q)


tau.hat <- transition_matrix_clcm(mod)



## End(Not run)

CJangelo/CLCM documentation built on May 22, 2022, 9:27 a.m.