| Title: | A Topic Testlet Model for Calibrating Testlet Constructed Responses |
|---|---|
| Description: | Implements the Topic Testlet Model (TTM) as described by Xiong et al. (2025) <doi:10.1111/jedm.70001>. The package integrates Latent Dirichlet Allocation (LDA) with the Partial Credit Model to account for local item dependence in testlets using latent topics from student textual responses. |
| Authors: | Jiawei Xiong [aut, cre], Cheng Tang [ctb], Qidi Liu [ctb] |
| Maintainer: | Jiawei Xiong <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.0 |
| Built: | 2026-06-01 09:06:03 UTC |
| Source: | https://github.com/cran/TopicTestlet |
Aggregates all written responses within a testlet for each student.
aggregate_responses(response_matrix)aggregate_responses(response_matrix)
response_matrix |
An N x J matrix of character strings (essays). |
A named character vector of length N.
Calibrates the TTM using score data and pre-computed topic proportions. Uses a Variational Expectation-Maximization (VEM) approach to estimate student ability (theta), topic penalties (lambda), and item parameters (b).
ttm_est(scores, delta, max_iter = 100, tol = 1e-04)ttm_est(scores, delta, max_iter = 100, tol = 1e-04)
scores |
An N x J numeric matrix of item scores (0, 1, ...). |
delta |
An N x K numeric matrix of topic proportions (from ttm_lda). |
max_iter |
Maximum number of EM iterations. |
tol |
Convergence tolerance. |
A list containing:
theta |
Vector of estimated student abilities. |
lambda |
Matrix of estimated topic penalties. |
gamma |
Vector of person-specific testlet effects. |
item_params |
List of step difficulties for each item. |
AIC |
Akaike Information Criterion. |
BIC |
Bayesian Information Criterion. |
Fits a Latent Dirichlet Allocation model to the text and returns the person-specific topic proportion matrix (delta).
ttm_lda(text_vector, k, seed = 1234)ttm_lda(text_vector, k, seed = 1234)
text_vector |
A character vector of aggregated student responses. |
k |
The number of latent topics. |
seed |
Integer seed for reproducibility. |
A matrix of dimension N x K containing topic proportions (delta).
Calculates the perplexity of LDA models over a range of K topics to help determine the optimal number of topics.
ttm_perplexity(text_vector, k_range = 2:5, seed = 1234)ttm_perplexity(text_vector, k_range = 2:5, seed = 1234)
text_vector |
A character vector of aggregated student responses (length N). |
k_range |
A numeric vector indicating the number of topics to try (e.g., 2:10). |
seed |
Integer seed for reproducibility. |
A data frame containing K and the corresponding perplexity score.