Latent Class and Rank Analysis

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 7,
  fig.height = 5,
  out.width = "100%"
)

Note: Some computationally intensive examples below are shown with eval=FALSE to keep CRAN build times short. For full rendered output, see the pkgdown site.

library(exametrika)

Latent Class Analysis (LCA)

LCA classifies examinees into unordered latent classes. Specify the dataset and the number of classes.

LCA(J15S500, ncls = 5)

The Class Membership Matrix indicates which latent class each examinee belongs to:

result.LCA <- LCA(J15S500, ncls = 5)
head(result.LCA$Students)

LCA Plot Types

plot(result.LCA, type = "IRP", items = 1:6, nc = 2, nr = 3)
plot(result.LCA, type = "CMP", students = 1:9, nc = 3, nr = 3)
plot(result.LCA, type = "TRP")
plot(result.LCA, type = "LCD")

Latent Rank Analysis (LRA)

LRA is similar to LCA but assumes an ordering among the latent classes (ranks). Specify the dataset and the number of ranks.

LRA(J15S500, nrank = 6)

Rank membership probabilities and rank-up/rank-down odds are calculated:

result.LRA <- LRA(J15S500, nrank = 6)
head(result.LRA$Students)
plot(result.LRA, type = "IRP", items = 1:6, nc = 2, nr = 3)
plot(result.LRA, type = "RMP", students = 1:9, nc = 3, nr = 3)
plot(result.LRA, type = "TRP")
plot(result.LRA, type = "LRD")

LRA for Ordinal Data

LRA can also handle ordinal scale data. The mic option enforces monotonic increasing constraints.

result.LRAord <- LRA(J15S3810, nrank = 3, mic = TRUE)

Score-rank relationship visualizations:

plot(result.LRAord, type = "ScoreFreq")
plot(result.LRAord, type = "ScoreRank")

Item-rank relationship plots:

plot(result.LRAord, type = "ICBR", items = 1:4, nc = 2, nr = 2)
plot(result.LRAord, type = "ICRP", items = 1:4, nc = 2, nr = 2)

Rank membership profiles for individual examinees:

plot(result.LRAord, type = "RMP", students = 1:9, nc = 3, nr = 3)

LRA for Rated/Nominal Data

For multiple-choice tests (nominal scale), LRA can analyze response patterns including distractor choices.

result.LRArated <- LRA(J35S5000, nrank = 10, mic = TRUE)
plot(result.LRArated, type = "ScoreFreq")
plot(result.LRArated, type = "ScoreRank")
plot(result.LRArated, type = "ICRP", items = 1:4, nc = 2, nr = 2)

Reference

Shojima, K. (2022). Test Data Engineering. Springer.



Try the exametrika package in your browser

Any scripts or data that you put into this service are public.

exametrika documentation built on Aug. 20, 2026, 5:08 p.m.