Hey, sorry it took so long to get back to you work has been a bit snowed under last couple of days. Thanks for taking the time. I tried my best to make a reprex though I couldn't get everything from the instructions to work 100%. I hope this is sufficient though
```{r setup, include=FALSE}
#packages needed:
library(tidyLPA)
library(mclust)
library(rio)
library(dplyr)
library(openxlsx)
#example data, similar to my real data as it has several personality traits and emotion regulation strategies.
trait_one <- c(10,15,20,8,15,12,14,15,18,9,7,12,12,7,21)
trait_two <- c(9,7,12,22,23,4,3,8,9,2,8,22,8,4,22)
trait_three <-c(8,3,22,12,7,4,4,8,3,12,11,21,6,5,20)
trait_four <- c(14,14,2,9,4,5,19,24,25,12,14,8,9,1,12)
strat_1 <- c(4,5,2,8,10,8,2,6,4,3,8,9,3,9,5)
strat_2 <- c(1,5,4,2,5,8,1,8,9,7,3,3,8,3,9)
strat_3 <- c(9,6,2,6,1,8,1,6,6,7,5,3,2,4,6)
strat_4 <- c(9,1,6,3,2,10,4,10,3,5,3,3,7,3,2)
strat_5 <- c(10,6,3,4,8,9,3,2,7,2,4,5,4,1,8)
df <- data.frame(trait_one,trait_two,trait_three,trait_four,strat_1,strat_2,strat_3,strat_4,strat_5)
df
#below command will run LPA. This will force a run of three profile solution, which will be enough to test out getting separate density plots.
LPA_analysis <- df[, ] %>%
select(trait_one,trait_two,trait_three,trait_four,strat_1,strat_2,strat_3,strat_4,strat_5) %>%
single_imputation() %>%
estimate_profiles(3,
variances = c("equal"),
covariances = c("zero"))
#This will make density plots. In this example, I want to generate three separate plots, one for each profile/class, showing the distribution of all univariate variables in said profile. However, this command is generating all profiles (1-3) at the same time.
plot_density(LPA_analysis$model_1_class_3)
If you need anything else please let me know and thanks again for your help.
L