Getting Packages Ready

library(tidyLPA)
## Warning: package 'tidyLPA' was built under R version 4.3.2
## You can use the function citation('tidyLPA') to create a citation for the use of {tidyLPA}.
## Mplus is not installed. Use only package = 'mclust' when calling estimate_profiles().
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.3.2
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(mclust)
## Warning: package 'mclust' was built under R version 4.4.0
## Package 'mclust' version 6.0.1
## Type 'citation("mclust")' for citing this R package in publications.

Import Data

Data <- read.csv("G:/Shared Data/Research/Administration/Evaluation/Assessment/2023 Amira Study/Data/Exploratory Analysis/Latent Profile Analysis - School - Classroom - For R.csv")
Data<- Data %>%
  rename("Classroom" = "Class")

Estimation of profiles

prof1 <- Data %>%
  select(Amira.Weeks.Lapsed, Amira.Average.Weekly.Practice) %>%
  single_imputation() %>%
  estimate_profiles(1:6, variances = "varying", covariances = "zero")
prof1
## tidyLPA analysis using mclust: 
## 
##  Model Classes AIC       BIC       Entropy prob_min prob_max n_min n_max BLRT_p
##  2     1       157341.28 157371.67 1.00    1.00     1.00     1.00  1.00        
##  2     2       144281.82 144350.19 0.74    0.73     0.99     0.14  0.86  0.01  
##  2     3       137757.94 137864.30 0.72    0.79     0.92     0.10  0.45  0.01  
##  2     4       135502.60 135646.95 0.69    0.57     0.91     0.09  0.46  0.01  
##  2     5       133680.90 133863.23 0.69    0.65     0.90     0.04  0.36  0.01  
##  2     6       132803.84 133024.16 0.69    0.57     0.89     0.04  0.33  0.01

Plot of the third profile

plot_profiles(prof1[[3]], rawdata=FALSE)

## Estimates for the variables

prof3 <- Data %>%
  select(Amira.Weeks.Lapsed, Amira.Average.Weekly.Practice) %>%
  single_imputation() %>%
  estimate_profiles(3, variances = "varying", covariances = "zero")
estimate3 <- get_estimates(prof3)
print(estimate3, n = 24) 
## # A tibble: 12 × 8
##    Category  Parameter             Estimate     se         p Class Model Classes
##    <chr>     <chr>                    <dbl>  <dbl>     <dbl> <int> <dbl>   <dbl>
##  1 Means     Amira.Weeks.Lapsed      34.1   0.0405 0             1     2       3
##  2 Means     Amira.Average.Weekly…    1.07  0.0198 0             1     2       3
##  3 Variances Amira.Weeks.Lapsed       5.54  0.163  6.88e-254     1     2       3
##  4 Variances Amira.Average.Weekly…    0.482 0.0185 2.19e-149     1     2       3
##  5 Means     Amira.Weeks.Lapsed      36.7   0.0280 0             2     2       3
##  6 Means     Amira.Average.Weekly…    3.91  0.0386 0             2     2       3
##  7 Variances Amira.Weeks.Lapsed       2.68  0.0568 0             2     2       3
##  8 Variances Amira.Average.Weekly…    3.97  0.136  1.39e-187     2     2       3
##  9 Means     Amira.Weeks.Lapsed      25.2   0.266  0             3     2       3
## 10 Means     Amira.Average.Weekly…    3.61  0.162  4.79e-110     3     2       3
## 11 Variances Amira.Weeks.Lapsed      66.3   1.75   0             3     2       3
## 12 Variances Amira.Average.Weekly…   20.1   1.38   5.11e- 48     3     2       3