latent trajectory for mixed multi-level models in R

21 views Asked by At

I have a dataset (sample as below) where I want to cluster individuals based on their latent trajectories to model predictions for a different dataset. I am having trouble due to the multi-level aspect and am seeking advice on the best approach (R package) to model the below data to determine the latent classifications for further modeling.

In the sample data, n/2 people (ID) fell into either the intervention or control group where each person had repeated pre/post data across measurement types.

n <- 100

sampleDF <- data.frame(
  ID = factor(rep(1:n, each = 4)),  
  PrePost = factor(rep(rep(c("Pre", "Post"), each = 2), times = n)), 
  MeasurementType = factor(rep(rep(c("ScaleA", "ScaleB"), each = 1), times = 2 * n)), 
  Group = factor(rep(c(rep("Intervention", n/2), rep("Control", n/2)), each = 4)), 
  Score = rnorm(4 * n, mean = 3, sd = .5))

I originally tried using the flexmix package in R but I cannot find documentation on how to incorporate multiple groups as demonstrated in the sample data provided

0

There are 0 answers