LCA {exametrika} | R Documentation |
Latent Class Analysis
Description
A function for estimating LCA using the EM algorithm.
Usage
LCA(U, ncls = 2, na = NULL, Z = NULL, w = NULL, maxiter = 100)
Arguments
U |
U is either a data class of exametrika, or raw data. When raw data is given, it is converted to the exametrika class with the dataFormat function. |
ncls |
number of latent class |
na |
na argument specifies the numbers or characters to be treated as missing values. |
Z |
Z is a missing indicator matrix of the type matrix or data.frame |
w |
w is item weight vector |
maxiter |
Maximum number of iterations. |
Value
- nobs
Sample size. The number of rows in the dataset.
- testlength
Length of the test. The number of items included in the test.
- Nclass
number of classes you set
- TRP
Test Reference Profile matrix. The TRP is the column sum vector of estimated class reference matrix,
\hat{\Pi}_c
- LCD
Latent Class Distribution table.see also plot.exametrika
- CMD
Class Membership Distribution table. see also plot.exametrika
- Students
Class Membership Profile matrix.The s-th row vector of
\hat{M}_c
,\hat{m}_c
, is the class membership profile of Student s, namely the posterior probability distribution representing the student's belonging to the respective latent classes. The last column indicates the latent class estimate.- IRP
Item Reference Profile matrix.The IRP of item j is the j-th row vector in the class reference matrix,
\hat{\pi}_c
- ItemFitIndices
Fit index for each item.See also ItemFit
- TestFitIndices
Overall fit index for the test.See also TestFit
Examples
# Fit a Latent Class Analysis model with 5 classes to the sample dataset
result.LCA <- LCA(J15S500, ncls = 5)
# Display the first few rows of student class membership probabilities
head(result.LCA$Students)
# Plot Item Response Profiles (IRP) for items 1-6 in a 2x3 grid
plot(result.LCA, type = "IRP", items = 1:6, nc = 2, nr = 3)
# Plot Class Membership Probabilities (CMP) for students 1-9 in a 3x3 grid
plot(result.LCA, type = "CMP", students = 1:9, nc = 3, nr = 3)
# Plot Test Response Profile (TRP) showing response patterns across all classes
plot(result.LCA, type = "TRP")
# Plot Latent Class Distribution (LCD) showing the size of each latent class
plot(result.LCA, type = "LCD")