| Title: | Generalized Multicomponent Latent Trait Model for Diagnosis |
|---|---|
| Description: | Provides Bayesian estimation of Item Response Theory models that decompose item difficulty into cognitive operations or rules. Implements the Linear Logistic Test Model (LLTM; Fischer (1973) <doi:10.1016/0001-6918(73)90003-6>), the Multicomponent Latent Trait Model for Diagnosis (MLTM-D; Embretson and Yang (2013) <doi:10.1007/s11336-012-9296-y>), and the Generalized Multicomponent Latent Trait Model for Diagnosis (GMLTM-D; Ramirez et al. (2024) <doi:10.3390/jintelligence12070067>), including a variant with correlated latent components. All models are estimated via Hamiltonian Monte Carlo using 'Stan' through the 'rstan' interface. Includes tools for prior predictive checks (Gelman et al., 2020), model validation, conditional reliability estimation, examinee mastery classification following Embretson (2019) <doi:10.1007/978-3-030-05584-4_9>, and individual diagnostic reports at the rule and component level. Supports user-defined prior distributions for all model parameters. |
| Authors: | Eduar Ramirez [aut, cre], Marcos Jimenez [aut], Vithor R. Franco [aut], Jesus Alvarado [aut] |
| Maintainer: | Eduar Ramirez <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 2.0.0 |
| Built: | 2026-10-26 08:20:41 UTC |
| Source: | https://github.com/eduar-ramirez/gmltm-d |
Binary item response data from a figural analogies test used to illustrate the LLTM, MLTM-D, and GMLTM-D models.
analogyanalogy
A matrix with 149 rows (subjects) and 27 columns (items), where each cell contains a binary response (0 = incorrect, 1 = correct).
Blum, D., Holling, H., Galibert, M. S., & Forthmann, B. (2016). Task difficulty prediction of figural analogies. Intelligence, 56, 72–81. doi:10.1016/j.intell.2016.03.001
Ramirez, E. S., Jimenez, M., Franco, V. R., & Alvarado, J. M. (2024). Delving into the complexity of analogical reasoning: A detailed exploration with the Generalized Multicomponent Latent Trait Model for Diagnosis. Journal of Intelligence, 12, 67. doi:10.3390/jintelligence12070067
Verifies if the data is suitable for robust reliability analysis.
check_reliability_data_quality(fit)check_reliability_data_quality(fit)
fit |
Fitted model |
List with data quality diagnostics
Other reliability functions:
demo_reliability_analysis(),
enhanced_mltm_reliability(),
export_reliability_results(),
quick_reliability_check(),
reliability(),
reliability_usage_instructions()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) dq <- check_reliability_data_quality(fit) print(dq)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) dq <- check_reliability_data_quality(fit) print(dq)
Compare Conditional Reliability Between Components at Specific Theta Values
compare_conditional_reliability(cond_rel_obj, theta_points = c(-1, 0, 1))compare_conditional_reliability(cond_rel_obj, theta_points = c(-1, 0, 1))
cond_rel_obj |
An object of class |
theta_points |
Numeric vector of theta values at which to compare components.
Default is |
Invisibly returns a data frame with columns theta,
reliability, and se evaluated at the requested
theta_points. Called primarily for its side effect of
printing a formatted summary table to the console.
Other conditional reliability functions:
conditional_reliability_tif(),
integrate_with_enhanced_reliability(),
plot_all_components(),
plot_components_comparison(),
plot_conditional_reliability(),
reliability_profile()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) compare_conditional_reliability(cond_rel, theta_points = c(-1, 0, 1))if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) compare_conditional_reliability(cond_rel, theta_points = c(-1, 0, 1))
This function extracts the log-likelihood from a GMLTM model and computes the Leave-One-Out Cross-Validation (LOO) and the Widely Applicable Information Criterion (WAIC). LOO is a Bayesian model comparison metric based on Pareto-smoothed importance sampling, while WAIC is a fully Bayesian criterion that estimates predictive accuracy.
compute_model_validation(fit)compute_model_validation(fit)
fit |
A fitted GMLTM model or a list of fitted models. Models fitted with
|
If a single model is provided, returns a list with LOO and WAIC results.
If multiple models are provided, returns a summary table with key LOO and WAIC
indices, labeled by model type (e.g. "GMLTM-D (Sigma libre)" for
GMLTM_corr fits, "GMLTM-D (Sigma=I)" for GMLTM fits).
Vehtari, A., Gelman, A., & Gabry, J. (2017). Practical Bayesian model evaluation using LOO-CV and WAIC. Statistics and Computing, 27(5), 1413–1432. doi:10.1007/s11222-016-9696-4
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit1 <- GMLTM(data = analogy, Q = Q, components = components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) compute_model_validation(fit1)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit1 <- GMLTM(data = analogy, Q = Q, components = components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) compute_model_validation(fit1)
Calculates conditional reliability using Test Information Function for 3-parameter MLTM-D models. This approach is more precise than quantile-based partitioning methods.
conditional_reliability_tif( fit, theta_range = seq(-3, 3, 0.2), component = NULL, n_samples = 1000 )conditional_reliability_tif( fit, theta_range = seq(-3, 3, 0.2), component = NULL, n_samples = 1000 )
fit |
Fitted model with |
theta_range |
Vector of |
component |
Integer or character. Specific component to analyze |
n_samples |
Integer. Number of posterior samples to use |
A list of class "conditional_reliability_tif" with elements:
thetaNumeric vector of theta values.
reliabilityNumeric vector of reliability estimates at each theta value.
informationNumeric vector of test information values at each theta value.
componentInteger indicating the model component.
fitThe original fitted model object.
Other conditional reliability functions:
compare_conditional_reliability(),
integrate_with_enhanced_reliability(),
plot_all_components(),
plot_components_comparison(),
plot_conditional_reliability(),
reliability_profile()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) cond_rel$global$optimal_thetaif (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) cond_rel$global$optimal_theta
Demonstration function to show how to use the optimized functions.
demo_reliability_analysis(fit)demo_reliability_analysis(fit)
fit |
Fitted model |
Invisibly returns a list with the reliability estimates computed at each step of the analysis. Called primarily for its side effect of printing a step-by-step explanation to the console.
Other reliability functions:
check_reliability_data_quality(),
enhanced_mltm_reliability(),
export_reliability_results(),
quick_reliability_check(),
reliability(),
reliability_usage_instructions()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) demo_reliability_analysis(fit)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) demo_reliability_analysis(fit)
Provides comprehensive reliability analysis for General Multicomponent Latent Trait Models for Diagnosis (GMLTM-D) using Bayesian posterior distributions. Optimized for speed and minimal dependencies.
enhanced_mltm_reliability( fit, include_conditional = FALSE, include_hierarchical = TRUE, include_comparisons = TRUE, n_samples = NULL )enhanced_mltm_reliability( fit, include_conditional = FALSE, include_hierarchical = TRUE, include_comparisons = TRUE, n_samples = NULL )
fit |
A fitted GMLTM, MLTM, or LLTM model object containing posterior samples of theta parameters. |
include_conditional |
Logical. Whether to compute conditional reliability estimates across ability levels. Default is FALSE for speed. |
include_hierarchical |
Logical. Whether to compute hierarchical reliability for the general factor. Default is TRUE. |
include_comparisons |
Logical. Whether to perform Bayesian comparisons between components. Default is TRUE. |
n_samples |
Integer. Number of posterior samples to use (for speed control). If NULL, uses all available samples. |
An object of class enhanced_mltm_reliability.
Other reliability functions:
check_reliability_data_quality(),
demo_reliability_analysis(),
export_reliability_results(),
quick_reliability_check(),
reliability(),
reliability_usage_instructions()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) rel <- enhanced_mltm_reliability(fit, n_samples = 100) rel$marginal_robustif (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) rel <- enhanced_mltm_reliability(fit, n_samples = 100) rel$marginal_robust
Exports results in tabular format for publications.
export_reliability_results(reliability_obj, file_name = NULL)export_reliability_results(reliability_obj, file_name = NULL)
reliability_obj |
Object of class enhanced_mltm_reliability |
file_name |
File name (optional) |
data.frame with tabulated results
Other reliability functions:
check_reliability_data_quality(),
demo_reliability_analysis(),
enhanced_mltm_reliability(),
quick_reliability_check(),
reliability(),
reliability_usage_instructions()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) rel <- enhanced_mltm_reliability(fit, n_samples = 100) export_reliability_results(rel)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) rel <- enhanced_mltm_reliability(fit, n_samples = 100) export_reliability_results(rel)
Extracts the posterior correlation matrix among cognitive
components from a model fitted with GMLTM_corr, together with
pairwise credible intervals and a heatmap for visual inspection.
extract_correlation(fit, credible = 0.95, plot = TRUE)extract_correlation(fit, credible = 0.95, plot = TRUE)
fit |
An object of class |
credible |
Width of the credible interval for each pairwise
correlation, e.g. |
plot |
Logical. If |
The pairwise credible intervals are computed from the posterior draws of
Sigma in fit$fit, extracted with rstan::extract() (not
from fit$EAP$Sigma, which only holds the posterior mean). A pair of
components is flagged as showing evidence of a real (non-zero) correlation
when its credible interval excludes 0.
A list of class "GMLTM_correlation" with elements:
SigmaThe M x M posterior mean correlation matrix
(fit$EAP$Sigma).
pairsA data.frame with one row per pair of components:
component_1, component_2, estimate, lower,
upper, and excludes_zero (logical).
credibleThe credible-interval width used.
plotA function that redraws the heatmap when called with
no arguments, or NULL if plot = FALSE.
Embretson, S. E., & Yang, X. (2013). A multicomponent latent trait model for diagnosis. Psychometrika, 78, 14–36. doi:10.1007/s11336-012-9296-y
Other diagnostic reporting functions:
student_report(),
student_report_batch()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM_corr(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) corr <- extract_correlation(fit) corr$pairsif (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM_corr(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) corr <- extract_correlation(fit) corr$pairs
This function generates interaction terms between rules within the same component, extends the Q-matrix, and evaluates the resulting matrix for collinearity issues using eigenvalues, condition indices, and variance inflation factors (VIF). If severe collinearity is detected, it attempts to iteratively remove problematic interaction terms while keeping the original rules untouched.
generate_Q_with_interactions( Q, M_list, max_condition_index = 30, min_eigenvalue = 0.1, plot_diagnostics = TRUE, verbose = TRUE, save_to_global = TRUE )generate_Q_with_interactions( Q, M_list, max_condition_index = 30, min_eigenvalue = 0.1, plot_diagnostics = TRUE, verbose = TRUE, save_to_global = TRUE )
Q |
A binary matrix of items by rules (original Q-matrix). Each row represents an item and each column represents a rule. Values should be 0 or 1. |
M_list |
A list where each element contains the indices of rules that belong to the same component/dimension. For example, list(c(1,2,3), c(4,5)) indicates that rules 1,2,3 belong to component 1 and rules 4,5 belong to component 2. |
max_condition_index |
Numeric. Maximum acceptable condition index. Default is 30. Values above this threshold indicate severe collinearity. |
min_eigenvalue |
Numeric. Minimum acceptable eigenvalue. Default is 0.1. Values below this threshold may indicate linear dependence. |
plot_diagnostics |
Logical. Whether to generate diagnostic plots. Default is TRUE. |
verbose |
Logical. Whether to print detailed diagnostic information. Default is TRUE. |
save_to_global |
Logical. Whether to save results to global environment. Default is TRUE. |
The function performs the following steps:
Validates input parameters
Generates interaction terms for rules within the same component
Performs collinearity diagnostics using multiple methods
Attempts to resolve severe collinearity by removing problematic interactions
Generates diagnostic plots and summaries
Collinearity is assessed using:
Condition indices (based on eigenvalues of correlation matrix)
Variance Inflation Factors (VIF)
Matrix rank assessment
Eigenvalue analysis
A list containing:
Q_extended |
The extended Q-matrix with interaction terms |
M_list_extended |
Updated component list including interaction terms |
diagnostics |
List with collinearity diagnostics |
removed_interactions |
Vector of removed interaction names (if any) |
plots |
List of diagnostic plots (if plot_diagnostics = TRUE) |
Belsley, D. A., Kuh, E., & Welsch, R. E. (1980). Regression diagnostics: Identifying influential data and sources of collinearity. John Wiley & Sons. O'Brien, R. M. (2007). A caution regarding rules of thumb for variance inflation factors. Quality & Quantity, 41(5), 673-690. Hair, J. F., Anderson, R. E., Tatham, R. L., & Black, W. C. (1995). Multivariate data analysis. Prentice Hall.
# Create a sample Q-matrix (5 items, 4 rules) Q <- matrix(c(1,1,0,0,0, 1,0,1,0,0, 0,1,1,0,0, 0,0,0,1,1), nrow=5, ncol=4, byrow=FALSE) # Define components (rules 1-2 in component 1, rules 3-4 in component 2) M_list <- list(c(1,2), c(3,4)) # Generate extended Q-matrix with interactions result <- generate_Q_with_interactions(Q, M_list) # Access results extended_Q <- result$Q_extended diagnostics <- result$diagnostics plots <- result$plots# Create a sample Q-matrix (5 items, 4 rules) Q <- matrix(c(1,1,0,0,0, 1,0,1,0,0, 0,1,1,0,0, 0,0,0,1,1), nrow=5, ncol=4, byrow=FALSE) # Define components (rules 1-2 in component 1, rules 3-4 in component 2) M_list <- list(c(1,2), c(3,4)) # Generate extended Q-matrix with interactions result <- generate_Q_with_interactions(Q, M_list) # Access results extended_Q <- result$Q_extended diagnostics <- result$diagnostics plots <- result$plots
Estimate the parameters of the GMLTM-D via Bayesian Hamiltonian Monte Carlo.
GMLTM( data, Q, components, iters = 2000, chains = 2, iter_warmup = 1000, quantiles = c(0.025, 0.5, 0.975), cores = parallel::detectCores() - 1, priors = list(theta = list(mu = 0, sigma = 1), eta = list(mu = 0, sigma = 1), alpha = list(mu = 0, sigma = 1, family = "normal"), c = list(shape1 = 3, shape2 = 20)), ... )GMLTM( data, Q, components, iters = 2000, chains = 2, iter_warmup = 1000, quantiles = c(0.025, 0.5, 0.975), cores = parallel::detectCores() - 1, priors = list(theta = list(mu = 0, sigma = 1), eta = list(mu = 0, sigma = 1), alpha = list(mu = 0, sigma = 1, family = "normal"), c = list(shape1 = 3, shape2 = 20)), ... )
data |
An |
Q |
A |
components |
A named list grouping rules into components. Each element is
a numeric vector of rule indices belonging to that component.
Example: |
iters |
Number of post-warmup MCMC iterations per chain. Default is 2000. |
chains |
Number of Markov chains. Default is 2. |
iter_warmup |
Number of warmup iterations per chain. Default is 1000. |
quantiles |
Numeric vector of probabilities for posterior quantiles.
Default is |
cores |
Number of CPU cores for parallel chains.
Default is |
priors |
A named list of prior hyperparameters with elements |
... |
Additional arguments passed to |
GMLTM estimates the Generalized Multicomponent Latent Trait Model for
Diagnosis (GMLTM-D; Ramirez et al., 2024) in its Bayesian version. This model
analyses items composed of cognitive rules or operations, incorporating three IRT
parameters. Rules can be grouped into distinct components.
Prior distributions: Ability () and rule difficulty
() receive Normal priors. Discrimination () receives
either a half-Normal prior (priors$alpha$family = "normal", default)
or a Log-Normal prior (priors$alpha$family = "lognormal"). Guessing
() receives a Beta prior.
A list of class "GMLTM" with elements:
EAPPosterior mean estimates: theta, alpha,
eta, beta, guessing.
quantilesPosterior credible intervals for each parameter.
posteriorFull posterior samples and derived quantities.
fitThe stanfit object from rstan::sampling.
dataThe original data matrix.
priorsThe prior hyperparameters used.
Ramirez, E. S., Jimenez, M., Franco, V. R., & Alvarado, J. M. (2024). Delving into the complexity of analogical reasoning: A detailed exploration with the Generalized Multicomponent Latent Trait Model for Diagnosis. Journal of Intelligence, 12, 67. doi:10.3390/jintelligence12070067
Other model fitting functions:
GMLTM_corr(),
LLTM(),
MLTM()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) fit$EAP$eta reliability(fit)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) fit$EAP$eta reliability(fit)
Variant of GMLTM that replaces the independent prior on
() with a multivariate Normal prior
with a general correlation matrix , estimated from the data via
its Cholesky factor (non-centered parameterization with an LKJ prior on the
correlation). This corresponds to innovation (iii) of the GMLTM-D as
formulated in Ramirez et al. (2024): allowing correlations between
components to reflect the natural interdependence between cognitive
abilities, instead of assuming independent latent traits.
GMLTM_corr( data, Q, components, iters = 2000, chains = 2, iter_warmup = 1000, quantiles = c(0.025, 0.5, 0.975), cores = parallel::detectCores() - 1, priors = list(theta = list(mu = 0, sigma = 1), eta = list(mu = 0, sigma = 1), alpha = list(mu = 0, sigma = 1, family = "normal"), c = list(shape1 = 3, shape2 = 20)), lkj_eta = 1, ... )GMLTM_corr( data, Q, components, iters = 2000, chains = 2, iter_warmup = 1000, quantiles = c(0.025, 0.5, 0.975), cores = parallel::detectCores() - 1, priors = list(theta = list(mu = 0, sigma = 1), eta = list(mu = 0, sigma = 1), alpha = list(mu = 0, sigma = 1, family = "normal"), c = list(shape1 = 3, shape2 = 20)), lkj_eta = 1, ... )
data |
An |
Q |
A |
components |
A named list grouping rules into components. Each element is
a numeric vector of rule indices belonging to that component.
Example: |
iters |
Number of post-warmup MCMC iterations per chain. Default is 2000. |
chains |
Number of Markov chains. Default is 2. |
iter_warmup |
Number of warmup iterations per chain. Default is 1000. |
quantiles |
Numeric vector of probabilities for posterior quantiles.
Default is |
cores |
Number of CPU cores for parallel chains.
Default is |
priors |
A named list of prior hyperparameters with elements |
lkj_eta |
Concentration parameter of the LKJ prior on the correlation
matrix |
... |
Additional arguments passed to |
GMLTM_corr estimates the same likelihood as GMLTM
(three IRT parameters per item/component: discrimination ,
guessing , and rule difficulty /), but replaces
the prior on the subject-level ability matrix with
, where is a correlation
matrix among the M cognitive components. is
parameterized through its Cholesky factor L_Omega (a
cholesky_factor_corr), with theta = t(L_Omega %*% theta_raw)
and theta_raw ~ N(0, 1) i.i.d. (non-centered parameterization, which
improves posterior geometry relative to sampling directly from
the multivariate Normal). priors$theta is accepted for interface
compatibility with GMLTM but is not used: the scale of
is fixed to 1 by construction (diagonal of ), and
its prior is governed entirely by lkj_eta.
A list of class c("GMLTM_corr", "GMLTM") with elements:
EAPPosterior mean estimates: theta, alpha,
eta, beta, guessing, and Sigma (the
estimated M x M correlation matrix among components).
quantilesPosterior credible intervals for each parameter,
including Sigma.
posteriorFull posterior samples and derived quantities
(including loglik, used by compute_model_validation).
fitThe stanfit object from rstan::sampling.
dataThe original data matrix.
priorsThe prior hyperparameters used.
lkj_etaThe LKJ concentration parameter used.
Ramirez, E. S., Jimenez, M., Franco, V. R., & Alvarado, J. M. (2024). Delving into the complexity of analogical reasoning: A detailed exploration with the Generalized Multicomponent Latent Trait Model for Diagnosis. Journal of Intelligence, 12, 67. doi:10.3390/jintelligence12070067
Embretson, S. E., & Yang, X. (2013). A multicomponent latent trait model for diagnosis. Psychometrika, 78, 14–36. doi:10.1007/s11336-012-9296-y
Lewandowski, D., Kurowicka, D., & Joe, H. (2009). Generating random correlation matrices based on vines and extended onion method. Journal of Multivariate Analysis, 100(9), 1989–2001. doi:10.1016/j.jmva.2009.04.008
Other model fitting functions:
GMLTM(),
LLTM(),
MLTM()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM_corr(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) fit$EAP$eta fit$EAP$Sigmaif (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM_corr(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) fit$EAP$eta fit$EAP$Sigma
Integrates conditional TIF analysis with existing reliability functions.
integrate_with_enhanced_reliability( fit, include_conditional_tif = TRUE, theta_range = seq(-3, 3, 0.1), ... )integrate_with_enhanced_reliability( fit, include_conditional_tif = TRUE, theta_range = seq(-3, 3, 0.1), ... )
fit |
A fitted GMLTM, MLTM, or LLTM model object. |
include_conditional_tif |
Logical. Whether to compute conditional TIF-based
reliability. Default is |
theta_range |
Numeric vector of theta values for conditional reliability evaluation.
Default is |
... |
Additional arguments passed to |
A list combining enhanced reliability results and, optionally, conditional TIF-based reliability.
Other conditional reliability functions:
compare_conditional_reliability(),
conditional_reliability_tif(),
plot_all_components(),
plot_components_comparison(),
plot_conditional_reliability(),
reliability_profile()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) result <- integrate_with_enhanced_reliability(fit, theta_range = seq(-2, 2, 0.5)) result$conditional_tifif (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) result <- integrate_with_enhanced_reliability(fit, theta_range = seq(-2, 2, 0.5)) result$conditional_tif
Estimate the parameters of the LLTM via Bayesian Hamiltonian Monte Carlo.
LLTM( data, Q, iters = 2000, chains = 2, iter_warmup = 1000, quantiles = c(0.025, 0.5, 0.975), cores = parallel::detectCores() - 1, priors = list(theta = list(mu = 0, sigma = 1), eta = list(mu = 0, sigma = 1)), ... )LLTM( data, Q, iters = 2000, chains = 2, iter_warmup = 1000, quantiles = c(0.025, 0.5, 0.975), cores = parallel::detectCores() - 1, priors = list(theta = list(mu = 0, sigma = 1), eta = list(mu = 0, sigma = 1)), ... )
data |
An |
Q |
A |
iters |
Number of post-warmup MCMC iterations per chain. Default is 2000. |
chains |
Number of Markov chains. Default is 2. |
iter_warmup |
Number of warmup iterations per chain. Default is 1000. |
quantiles |
Numeric vector of probabilities for posterior quantiles.
Default is |
cores |
Number of CPU cores for parallel chains.
Default is |
priors |
A named list of prior hyperparameters. Each element is a named
list with |
... |
Additional arguments passed to |
LLTM estimates the Bayesian version of the Linear Logistic Test Model
(Fischer, 1973), which extends the Rasch model by decomposing item difficulty
into cognitive rules. Item difficulty is expressed as
,
where is the i-th row of Q and is the
vector of rule difficulty parameters.
Prior distributions: Ability () and rule difficulty
() receive Normal priors. Prior sensitivity analysis is recommended.
A list of class "LLTM" with elements:
EAPPosterior mean estimates: theta, eta, beta.
quantilesPosterior credible intervals for each parameter.
posteriorFull posterior samples and derived quantities.
fitThe stanfit object from rstan::sampling.
dataThe original data matrix.
priorsThe prior hyperparameters used.
Fischer, G. H. (1973). The linear logistic test model as an instrument in educational research. Acta Psychologica, 37(6), 359–374. doi:10.1016/0001-6918(73)90003-6
Ramirez, E. S., Jimenez, M., Franco, V. R., & Alvarado, J. M. (2024). Delving into the complexity of analogical reasoning: A detailed exploration with the Generalized Multicomponent Latent Trait Model for Diagnosis. Journal of Intelligence, 12, 67. doi:10.3390/jintelligence12070067
Other model fitting functions:
GMLTM(),
GMLTM_corr(),
MLTM()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) fit <- LLTM(analogy, Q, iters = 200, iter_warmup = 100, chains = 1, cores = 1) fit$EAP$eta reliability(fit)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) fit <- LLTM(analogy, Q, iters = 200, iter_warmup = 100, chains = 1, cores = 1) fit$EAP$eta reliability(fit)
Computes and visualizes marginal success proportions, including predicted values, confidence intervals, RMSR, SRMR, and bias estimation.
marginal_Pchecks(fit, interval = 0.95)marginal_Pchecks(fit, interval = 0.95)
fit |
MLTM object containing model results. |
interval |
Probability associated with the credibility intervals (default = 0.95). |
marginal_Pchecks calculates marginal prediction intervals and observed success proportions.
It prints a table with observed vs. predicted values, generates a forest plot for visualization, and
computes key fit indices: RMSR, SRMR, and bias.
A list containing:
items: A table of fitted values and prediction intervals for each item.
rmsr: The Root Mean Square Residual (RMSR).
srmr: The Standardized Root Mean Square Residual (SRMR).
bias: The difference between the total observed and predicted proportions.
The function also generates:
A forest plot visualizing prediction intervals and observed success probabilities.
Ramirez, E. S., Jimenez, M., Franco, V. R., & Alvarado, J. M. (2024). Delving into the complexity of analogical reasoning: A detailed exploration with the Generalized Multicomponent Latent Trait Model for Diagnosis. Journal of Intelligence, 12, 67. doi:10.3390/jintelligence12070067
Other posterior predictive check functions:
ppchecks()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) fit <- LLTM(analogy, Q, iters = 200, iter_warmup = 100, chains = 1, cores = 1) marginal_Pchecks(fit)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) fit <- LLTM(analogy, Q, iters = 200, iter_warmup = 100, chains = 1, cores = 1) marginal_Pchecks(fit)
Estimate the parameters of the MLTM-D via Bayesian Hamiltonian Monte Carlo.
MLTM( data, Q, components, iters = 2000, chains = 2, iter_warmup = 1000, quantiles = c(0.025, 0.5, 0.975), cores = parallel::detectCores() - 1, priors = list(theta = list(mu = 0, sigma = 1), eta = list(mu = 0, sigma = 1), alpha = list(mu = 0, sigma = 1)), ... )MLTM( data, Q, components, iters = 2000, chains = 2, iter_warmup = 1000, quantiles = c(0.025, 0.5, 0.975), cores = parallel::detectCores() - 1, priors = list(theta = list(mu = 0, sigma = 1), eta = list(mu = 0, sigma = 1), alpha = list(mu = 0, sigma = 1)), ... )
data |
An |
Q |
A |
components |
A named list grouping rules into components. Each element is
a numeric vector of rule indices belonging to that component.
Example: |
iters |
Number of post-warmup MCMC iterations per chain. Default is 2000. |
chains |
Number of Markov chains. Default is 2. |
iter_warmup |
Number of warmup iterations per chain. Default is 1000. |
quantiles |
Numeric vector of probabilities for posterior quantiles.
Default is |
cores |
Number of CPU cores for parallel chains.
Default is |
priors |
A named list of prior hyperparameters with elements |
... |
Additional arguments passed to |
MLTM estimates the Bayesian version of the Multicomponent Latent Trait
Model for Diagnosis (MLTM-D; Embretson & Yang, 2013). This noncompensatory model
specifies a hierarchical relationship between components and rules.
Prior distributions: Ability () and rule difficulty ()
receive Normal priors. Discrimination () receives a half-Normal prior.
A list of class "MLTM" with elements:
EAPPosterior mean estimates: theta, alpha, eta, beta.
quantilesPosterior credible intervals for each parameter.
posteriorFull posterior samples and derived quantities.
fitThe stanfit object from rstan::sampling.
dataThe original data matrix.
priorsThe prior hyperparameters used.
Embretson, S. E., & Yang, X. (2013). A multicomponent latent trait model for diagnosis. Psychometrika, 78, 14–36. doi:10.1007/s11336-012-9296-y
Embretson, S. E. (2019). Diagnostic modeling of skill hierarchies and cognitive processes with MLTM-D. In M. von Davier & Y.-S. Lee (Eds.), Handbook of Diagnostic Classification Models (pp. 185–208). Springer. doi:10.1007/978-3-030-05584-4_9
Ramirez, E. S., Jimenez, M., Franco, V. R., & Alvarado, J. M. (2024). Delving into the complexity of analogical reasoning: A detailed exploration with the Generalized Multicomponent Latent Trait Model for Diagnosis. Journal of Intelligence, 12, 67. doi:10.3390/jintelligence12070067
Other model fitting functions:
GMLTM(),
GMLTM_corr(),
LLTM()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- MLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) fit$EAP$eta reliability(fit)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- MLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) fit$EAP$eta reliability(fit)
Creates individual plots for each component in the analysis.
plot_all_components( results, plot_type = "both", include_ci = TRUE, color_scheme = "blue", save_plots = FALSE, output_dir = NULL, ... )plot_all_components( results, plot_type = "both", include_ci = TRUE, color_scheme = "blue", save_plots = FALSE, output_dir = NULL, ... )
results |
An object of class |
plot_type |
Character. Type of plot: |
include_ci |
Logical. Whether to include credible interval bands. Default |
color_scheme |
Character. Color scheme for plots. Default |
save_plots |
Logical. Whether to save plots to disk. Default |
output_dir |
Character. Directory for saved plots. Default |
... |
Additional arguments passed to |
Invisibly returns NULL. Called for its side effect of
producing reliability plots for all model components.
Other conditional reliability functions:
compare_conditional_reliability(),
conditional_reliability_tif(),
integrate_with_enhanced_reliability(),
plot_components_comparison(),
plot_conditional_reliability(),
reliability_profile()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) plot_all_components(cond_rel, save_plots = TRUE, output_dir = tempdir())if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) plot_all_components(cond_rel, save_plots = TRUE, output_dir = tempdir())
Creates a single plot comparing conditional reliability across all components.
plot_components_comparison( results, include_ci = TRUE, show_optimal_points = TRUE, add_reference_lines = TRUE, color_palette = "Set2", save_plot = FALSE, filename = NULL, ... )plot_components_comparison( results, include_ci = TRUE, show_optimal_points = TRUE, add_reference_lines = TRUE, color_palette = "Set2", save_plot = FALSE, filename = NULL, ... )
results |
An object of class |
include_ci |
Logical. Whether to include credible interval bands. Default |
show_optimal_points |
Logical. Whether to mark optimal theta points. Default |
add_reference_lines |
Logical. Whether to add horizontal reference lines at 0.7, 0.8, 0.9.
Default |
color_palette |
Character. RColorBrewer palette name for component colors.
Default |
save_plot |
Logical. Whether to save the plot. Default |
filename |
Character. Output filename if |
... |
Additional graphical arguments. |
Invisibly returns NULL. Called for its side effect of
producing a comparative reliability plot across model components.
Other conditional reliability functions:
compare_conditional_reliability(),
conditional_reliability_tif(),
integrate_with_enhanced_reliability(),
plot_all_components(),
plot_conditional_reliability(),
reliability_profile()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) plot_components_comparison(cond_rel)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) plot_components_comparison(cond_rel)
Creates plots for conditional reliability analysis with multiple visualization options
plot_conditional_reliability( results, component = NULL, plot_type = "both", include_ci = TRUE, ci_level = 0.95, color_scheme = "blue", add_reference_lines = TRUE, save_plot = FALSE, filename = NULL, ... )plot_conditional_reliability( results, component = NULL, plot_type = "both", include_ci = TRUE, ci_level = 0.95, color_scheme = "blue", add_reference_lines = TRUE, save_plot = FALSE, filename = NULL, ... )
results |
Object of class conditional_reliability_tif |
component |
Integer or character. Component to plot (NULL for first component) |
plot_type |
Character. Type of plot: "reliability", "information", "both", "comparison" |
include_ci |
Logical. Include confidence intervals |
ci_level |
Numeric. Confidence level (0.90 or 0.95) |
color_scheme |
Character. Color scheme: "blue", "viridis", "custom" |
add_reference_lines |
Logical. Add reference lines for reliability levels |
save_plot |
Logical. Save plot to file |
filename |
Character. Filename if saving plot. Default |
... |
Additional plotting parameters |
Invisibly returns NULL. Called for its side effect of
producing one or two plots (reliability curve, test information
function, or both) depending on plot_type.
Other conditional reliability functions:
compare_conditional_reliability(),
conditional_reliability_tif(),
integrate_with_enhanced_reliability(),
plot_all_components(),
plot_components_comparison(),
reliability_profile()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) plot_conditional_reliability(cond_rel, component = 1)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) plot_conditional_reliability(cond_rel, component = 1)
Generates Item Characteristic Curves (ICCs) for a group of items displayed in a grid layout with a shared legend.
plot_ICC_grouped( fit, Q, components, page = 1, n_items_per_page = 9, ncol = 3, nrow = 3 )plot_ICC_grouped( fit, Q, components, page = 1, n_items_per_page = 9, ncol = 3, nrow = 3 )
fit |
A fitted GMLTM model object containing EAP parameter estimates. |
Q |
The Q-matrix indicating the association between items and rules. |
components |
A list where each element is a vector of rule indices per component. |
page |
Integer specifying which page of items to display. |
n_items_per_page |
Number of items to include per page. Default is 9. |
ncol |
Number of columns in the layout grid. Default is 3. |
nrow |
Number of rows in the layout grid. Default is 3. |
Displays one legend shared across all plots and ensures consistency across theta and probability axes. Ideal for publications or appendices.
A composed ICC grid with one shared legend, plotted to the active device.
Ramirez, E. S., Jimenez, M., Franco, V. R., & Alvarado, J. M. (2024). Delving into the complexity of analogical reasoning: A detailed exploration with the Generalized Multicomponent Latent Trait Model for Diagnosis. Journal of Intelligence, 12, 67. doi:10.3390/jintelligence12070067
Other item characteristic curve plots:
plot_ICC_individual()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) plot_ICC_grouped(fit, Q, components, page = 1)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) plot_ICC_grouped(fit, Q, components, page = 1)
Returns a list of individual ICC ggplot2 plots (one per item).
plot_ICC_individual(fit, Q, components)plot_ICC_individual(fit, Q, components)
fit |
A fitted GMLTM model object. |
Q |
The Q-matrix for rule-item associations. |
components |
A list indicating rule groupings per component. |
A list of individual ggplot objects, one per item.
Other item characteristic curve plots:
plot_ICC_grouped()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) plots <- plot_ICC_individual(fit, Q, components) print(plots[[1]])if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) plots <- plot_ICC_individual(fit, Q, components) print(plots[[1]])
Draws a histogram of the simulated proportion-correct distribution from
prior_predictive_check, with configurable reference lines
marking a substantively plausible range, in the style of Fig. 3 of Gelman
et al. (2020): a prior that concentrates simulated data outside that range
is a sign the prior is too informative, too diffuse, or otherwise
misspecified.
plot_prior_predictive_check( x, type = c("global", "by_item", "by_component"), plausible_range = c(0.2, 0.9), bins = 30 )plot_prior_predictive_check( x, type = c("global", "by_item", "by_component"), plausible_range = c(0.2, 0.9), bins = 30 )
x |
An object of class |
type |
Which simulated distribution to plot: |
plausible_range |
Numeric vector of length 2 giving the substantively
plausible range for the proportion correct, drawn as dashed reference
lines. Default is |
bins |
Number of histogram bins. Default is |
A ggplot2 object.
Other prior predictive check functions:
prior_predictive_check()
Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) ppc <- prior_predictive_check(Q, components, N = 150, S = 200) plot_prior_predictive_check(ppc)Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) ppc <- prior_predictive_check(Q, components, N = 150, S = 200) plot_prior_predictive_check(ppc)
Plot Method for conditional_reliability_tif Objects
## S3 method for class 'conditional_reliability_tif' plot(x, ...)## S3 method for class 'conditional_reliability_tif' plot(x, ...)
x |
An object of class |
... |
Additional arguments passed to |
Invisibly returns NULL. Called for its side effect of
producing a reliability and/or information plot via
plot_conditional_reliability().
Creates basic plots using base R (no ggplot2 dependency).
## S3 method for class 'enhanced_mltm_reliability' plot(x, type = "marginal", component = NULL, ...)## S3 method for class 'enhanced_mltm_reliability' plot(x, type = "marginal", component = NULL, ...)
x |
Object of class |
type |
Character. Type of plot: "marginal", "conditional", "comparison". |
component |
Integer or character. Specific component for conditional plots. |
... |
Additional plotting parameters. |
Invisibly returns NULL. Called for its side effects.
This function generates posterior predictive checks by plotting the observed and simulated total scores distribution, comparing empirical data against model predictions. It also computes fitted values and prediction intervals.
ppchecks(fit, nsim = 100, interval = 0.95, ...)ppchecks(fit, nsim = 100, interval = 0.95, ...)
fit |
A fitted MLTM object containing model results. |
nsim |
Number of simulated posterior samples (default = 100). |
interval |
Probability associated with the credibility intervals (default = 0.95). |
... |
Additional graphical parameters to customize the plot. |
The function simulates multiple datasets from the posterior distribution and compares the empirical distribution of total scores with the predicted distribution. It overlays the observed and predicted distributions using a histogram with transparency.
The fitted values, along with their credibility intervals, are computed and returned.
A list containing:
items: A table of fitted values and prediction intervals for each item.
subjects: Fitted and observed mean scores per subject.
ysim: Simulated response matrices.
The function also generates:
A histogram comparing observed vs. predicted total scores.
Ramirez, E. S., Jimenez, M., Franco, V. R., & Alvarado, J. M. (2024). Delving into the complexity of analogical reasoning: A detailed exploration with the Generalized Multicomponent Latent Trait Model for Diagnosis. Journal of Intelligence, 12, 67. doi:10.3390/jintelligence12070067
Other posterior predictive check functions:
marginal_Pchecks()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) fit <- LLTM(analogy, Q, iters = 200, iter_warmup = 100, chains = 1, cores = 1) ppchecks(fit)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) fit <- LLTM(analogy, Q, iters = 200, iter_warmup = 100, chains = 1, cores = 1) ppchecks(fit)
Print Method for Enhanced MLTM Reliability
## S3 method for class 'enhanced_mltm_reliability' print(x, digits = 3, ...)## S3 method for class 'enhanced_mltm_reliability' print(x, digits = 3, ...)
x |
An object of class |
digits |
Integer. Number of decimal places to display. Default is |
... |
Currently unused. |
Invisibly returns x. Called for its side effect of printing
the enhanced reliability analysis results to the console.
Print method for GMLTM objects
## S3 method for class 'GMLTM' print(x, digits = 3, ...)## S3 method for class 'GMLTM' print(x, digits = 3, ...)
x |
An object of class |
digits |
Number of decimal digits to display. Default is 3. |
... |
Currently ignored. |
Invisibly returns x.
Print Method for GMLTM_batch_report Objects
## S3 method for class 'GMLTM_batch_report' print(x, digits = 3, ...)## S3 method for class 'GMLTM_batch_report' print(x, digits = 3, ...)
x |
An object of class |
digits |
Number of decimal digits to display. Default is 3. |
... |
Currently ignored. |
Invisibly returns x.
Print method for GMLTM_corr objects
## S3 method for class 'GMLTM_corr' print(x, digits = 3, ...)## S3 method for class 'GMLTM_corr' print(x, digits = 3, ...)
x |
An object of class |
digits |
Number of decimal digits to display. Default is 3. |
... |
Currently ignored. |
Invisibly returns x.
Print method for GMLTM_correlation objects
## S3 method for class 'GMLTM_correlation' print(x, digits = 3, ...)## S3 method for class 'GMLTM_correlation' print(x, digits = 3, ...)
x |
An object of class |
digits |
Number of decimal digits to display. Default is 3. |
... |
Currently ignored. |
Invisibly returns x.
Print method for GMLTM_prior_predictive_check objects
## S3 method for class 'GMLTM_prior_predictive_check' print(x, digits = 3, ...)## S3 method for class 'GMLTM_prior_predictive_check' print(x, digits = 3, ...)
x |
An object of class |
digits |
Number of decimal digits to display. Default is 3. |
... |
Currently ignored. |
Invisibly returns x.
Print Method for GMLTM_student_report Objects
## S3 method for class 'GMLTM_student_report' print(x, digits = 3, ...)## S3 method for class 'GMLTM_student_report' print(x, digits = 3, ...)
x |
An object of class |
digits |
Number of decimal digits to display. Default is 3. |
... |
Currently ignored. |
Invisibly returns x.
Print method for LLTM objects
## S3 method for class 'LLTM' print(x, digits = 3, ...)## S3 method for class 'LLTM' print(x, digits = 3, ...)
x |
An object of class |
digits |
Number of decimal digits to display. Default is 3. |
... |
Currently ignored. |
Invisibly returns x.
Print method for MLTM objects
## S3 method for class 'MLTM' print(x, digits = 3, ...)## S3 method for class 'MLTM' print(x, digits = 3, ...)
x |
An object of class |
digits |
Number of decimal digits to display. Default is 3. |
... |
Currently ignored. |
Invisibly returns x.
Print Method for Data Quality Diagnostics
## S3 method for class 'reliability_data_quality' print(x, ...)## S3 method for class 'reliability_data_quality' print(x, ...)
x |
An object of class |
... |
Currently unused. |
Invisibly returns x. Called for its side effect of printing
the data quality diagnostics to the console.
Print Method for Reliability Profile
## S3 method for class 'reliability_profile' print(x, ...)## S3 method for class 'reliability_profile' print(x, ...)
x |
An object of class |
... |
Currently unused. |
Invisibly returns x. Called for its side effect of printing
a formatted reliability profile summary to the console.
Simulates parameters directly from the priors declared for
GMLTM/GMLTM_corr, simulates response data from
those parameters under the GMLTM-D's conjunctive structure, and returns
the resulting distribution of simulated proportion-correct – globally, per
item, and (optionally) per component – across replicates. This lets the
analyst check whether a candidate prior implies substantively plausible
data before spending compute on fitting the model to real data
(Gelman et al., 2020, Sect. 2.4).
prior_predictive_check( Q, components, N, S = 1000, priors = list(theta = list(mu = 0, sigma = 1), eta = list(mu = 0, sigma = 1), alpha = list(mu = 0, sigma = 1, family = "normal"), c = list(shape1 = 3, shape2 = 20)), by_component = TRUE )prior_predictive_check( Q, components, N, S = 1000, priors = list(theta = list(mu = 0, sigma = 1), eta = list(mu = 0, sigma = 1), alpha = list(mu = 0, sigma = 1, family = "normal"), c = list(shape1 = 3, shape2 = 20)), by_component = TRUE )
Q |
A |
components |
A named list grouping rules into components, identical
in role to the one passed to |
N |
Number of simulated examinees per replicate. |
S |
Number of replicates. Default is |
priors |
A named list of prior hyperparameters with the same
structure accepted by |
by_component |
Logical. If |
In each of the S replicates: rule difficulties are drawn
as for each rule of
each component, and item difficulty is ; abilities
are drawn i.i.d.
for N simulated examinees; guessing is drawn
per item; and discrimination
is drawn from priors$alpha$family – half-Normal
( truncated to ) or Log-Normal() – with one draw
per unique combination of rules that a component's items require (the same
grouping GMLTM itself uses, so alpha has as many free
values here as it would have as a Stan parameter). Response probabilities
follow the GMLTM-D's noncompensatory structure: for item of
examinee , , and
.
Use plot_prior_predictive_check to visualize the resulting
distribution against a substantively plausible range.
A list of class "GMLTM_prior_predictive_check" with elements:
globalNumeric vector of length S: the overall
simulated proportion correct in each replicate.
by_itemAn S x p matrix of simulated proportion
correct per item.
by_componentAn S x M matrix of simulated proportion
correct restricted to each component's items, or NULL if
by_component = FALSE.
N, S
The arguments used.
Q, components, priors
The arguments used
(priors after applying defaults).
Gelman, A., Vehtari, A., Simpson, D., Margossian, C. C., Carpenter, B., Yao, Y., Kennedy, L., Gabry, J., Burkner, P.-C., & Modrak, M. (2020). Bayesian workflow. arXiv. doi:10.48550/arXiv.2011.01808
Ramirez, E. S., Jimenez, M., Franco, V. R., & Alvarado, J. M. (2024). Delving into the complexity of analogical reasoning: A detailed exploration with the Generalized Multicomponent Latent Trait Model for Diagnosis. Journal of Intelligence, 12, 67. doi:10.3390/jintelligence12070067
Other prior predictive check functions:
plot_prior_predictive_check()
Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) ppc_normal <- prior_predictive_check(Q, components, N = 150, S = 200) summary(ppc_normal$global) ppc_lognormal <- prior_predictive_check( Q, components, N = 150, S = 200, priors = list(alpha = list(mu = 0, sigma = 1, family = "lognormal")) ) summary(ppc_lognormal$global)Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) ppc_normal <- prior_predictive_check(Q, components, N = 150, S = 200) summary(ppc_normal$global) ppc_lognormal <- prior_predictive_check( Q, components, N = 150, S = 200, priors = list(alpha = list(mu = 0, sigma = 1, family = "lognormal")) ) summary(ppc_lognormal$global)
Ultra-fast reliability check for initial assessment.
quick_reliability_check(fit, n_samples_quick = 500)quick_reliability_check(fit, n_samples_quick = 500)
fit |
Fitted model object. |
n_samples_quick |
Integer. Number of samples for quick analysis (default 500). |
Named vector of reliability estimates.
Other reliability functions:
check_reliability_data_quality(),
demo_reliability_analysis(),
enhanced_mltm_reliability(),
export_reliability_results(),
reliability(),
reliability_usage_instructions()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) fit <- LLTM(analogy, Q, iters = 200, iter_warmup = 100, chains = 1, cores = 1) quick_rel <- quick_reliability_check(fit) print(quick_rel)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) fit <- LLTM(analogy, Q, iters = 200, iter_warmup = 100, chains = 1, cores = 1) quick_rel <- quick_reliability_check(fit) print(quick_rel)
Estimate the the marginal reliability of the GMLTM.
reliability(fit)reliability(fit)
fit |
A fitted model object of class |
reliability computes the classical marginal reliability
coefficient for each cognitive component's ability estimates, from the
posterior mean and posterior variance of theta across subjects:
, where is the variance of the
EAP theta estimates across subjects (true-score variance) and is
the average posterior variance of theta across subjects (error variance).
A named numeric vector with one marginal reliability coefficient
per cognitive component (length 1 for LLTM fits, which have a
single ability dimension).
Ramirez, E. S., Jimenez, M., Franco, V. R., & Alvarado, J. M. (2024). Delving into the complexity of analogical reasoning: A detailed exploration with the Generalized Multicomponent Latent Trait Model for Diagnosis. Journal of Intelligence, 12, 67. doi:10.3390/jintelligence12070067
Other reliability functions:
check_reliability_data_quality(),
demo_reliability_analysis(),
enhanced_mltm_reliability(),
export_reliability_results(),
quick_reliability_check(),
reliability_usage_instructions()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) reliability(fit)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) reliability(fit)
Provides a quick overview of reliability characteristics for each component.
reliability_profile(cond_rel_obj)reliability_profile(cond_rel_obj)
cond_rel_obj |
An object of class |
A list of class "reliability_profile" with elements:
summaryData frame with columns theta,
reliability, lower, and upper.
componentInteger indicating which model component was analysed.
Other conditional reliability functions:
compare_conditional_reliability(),
conditional_reliability_tif(),
integrate_with_enhanced_reliability(),
plot_all_components(),
plot_components_comparison(),
plot_conditional_reliability()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) reliability_profile(cond_rel)if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) cond_rel <- conditional_reliability_tif(fit, theta_range = seq(-2, 2, 0.5)) reliability_profile(cond_rel)
Prints detailed usage instructions.
reliability_usage_instructions()reliability_usage_instructions()
Invisibly returns NULL. Called for its side effect of
printing step-by-step usage instructions to the console.
Other reliability functions:
check_reliability_data_quality(),
demo_reliability_analysis(),
enhanced_mltm_reliability(),
export_reliability_results(),
quick_reliability_check(),
reliability()
reliability_usage_instructions()reliability_usage_instructions()
Builds a per-component and per-rule diagnostic report for a single
examinee from a fitted GMLTM/GMLTM_corr
model: posterior EAP and credible interval of , a mastery
cutline per component and per rule,
derived from a mastery probability y, binary mastery vectors, a
decision-confidence index at both levels, and the difficulty of the
rules/items involved in each component. Follows the mastery-diagnosis
procedure for the MLTM-D described in Embretson (2019, Chap. 9, Sects.
9.2.2 and 9.4.2).
student_report( fit, Q, components, student_id, y = 0.5, theta_cut = NULL, credible = 0.95, digits = 3, include_plots = TRUE )student_report( fit, Q, components, student_id, y = 0.5, theta_cut = NULL, credible = 0.95, digits = 3, include_plots = TRUE )
fit |
An object of class |
Q |
A |
components |
A named list grouping rules into components, identical
to the one used to fit |
student_id |
Identifier of the examinee: either a row name of
|
y |
Mastery probability used to derive the cutlines |
theta_cut |
Optional fixed cutline(s) on the |
credible |
Width of the credible interval for |
digits |
Number of decimal digits used in the printed summary and
in the plot subtitles. Default is |
include_plots |
Logical. If |
For each component , the mastery cutline is the
value of at which the mean predicted probability of
solving the items that load on component ,
, equals
y (Embretson, 2019, Eq. in Sect. 9.2.2). It is found numerically
with uniroot using the item EAP estimates
fit$EAP$alpha, fit$EAP$beta, and fit$EAP$guessing.
If theta_cut is supplied, it is used directly as
and y is not used to derive it.
In addition, a rule-level cutline is computed for each
rule belonging to component , using the same root-finding
procedure as but restricted to the items that both load on
component and require rule specifically (Embretson, 2019,
Sect. 9.2.2). If no such item exists – the rule never appears on its own
among the component's items – is undefined: a warning is
issued and that rule is omitted from domain_rules and
confidence_rules for that component. Rule-level cutlines are
always derived from y and are not affected by theta_cut.
The student is classified as mastering component (domain
= 1) if , and as non-mastering
(domain = 0) otherwise; the same comparison of
against classifies mastery of rule
(domain_rules). Decision confidence is the proportion of
posterior draws of for that student that agree with the
classification: the proportion (or )
when classified as mastery, or the proportion (or
) when classified as non-mastery (Embretson, 2019, Sect.
9.4.2).
The difficulty of the rules assigned to each component is read from
fit$EAP$eta (rule-level difficulty, on the scale),
and the difficulty of the items that load on each component is read
from fit$EAP$beta (item-level difficulty). Q and
components are required because fit does not store the
item/component structure matrix C; it is recomputed internally
the same way as in plot_ICC_individual.
A list of class "GMLTM_student_report" with elements:
studentThe resolved identifier of the examinee (as it
appears in rownames(fit$data)).
thetaA list with EAP, lower, upper
(named by component) and credible.
cutlineA list with y, gamma (named by
component), tau (named list by component of named numeric
vectors of by rule, excluding any rule omitted for
lack of items) and fixed (logical, TRUE if
theta_cut was supplied).
domainNamed binary vector (1 = mastery, 0
= non-mastery) per component.
domain_rulesNamed list by component of named binary
vectors (1 = mastery, 0 = non-mastery) per rule,
excluding any rule omitted for lack of items.
confidenceNamed decision-confidence index per component.
confidence_rulesNamed list by component of named
decision-confidence indices per rule, same exclusions as
domain_rules.
difficultyA list with rules (named list of
rule-level difficulties per component) and items
(named list of item-level difficulties per component).
plotsNamed list of ggplot2 objects: one per
component, showing the rule difficulty continuum, the mastery
cutline, and the student's estimate with its credible
interval (colored green for mastery, red for non-mastery), inspired
by Figs. 4 and 5 of Embretson & Yang (2013); plus badges, a
single scannable summary of every component and rule with a green/red
mastery badge, complementing the continuum plots. NULL if
include_plots = FALSE.
Embretson, S. E. (2019). Diagnostic modeling of skill hierarchies and cognitive processes with MLTM-D. In M. von Davier & Y.-S. Lee (Eds.), Handbook of Diagnostic Classification Models (pp. 185–208). Springer. doi:10.1007/978-3-030-05584-4_9
Embretson, S. E., & Yang, X. (2013). A multicomponent latent trait model for diagnosis. Psychometrika, 78, 14–36. doi:10.1007/s11336-012-9296-y
Ramirez, E. S., Jimenez, M., Franco, V. R., & Alvarado, J. M. (2024). Delving into the complexity of analogical reasoning: A detailed exploration with the Generalized Multicomponent Latent Trait Model for Diagnosis. Journal of Intelligence, 12, 67. doi:10.3390/jintelligence12070067
Other diagnostic reporting functions:
extract_correlation(),
student_report_batch()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) report <- student_report(fit, Q, components, student_id = 11) report$domain report$domain_rules report$plots$global report$plots$badgesif (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) report <- student_report(fit, Q, components, student_id = 11) report$domain report$domain_rules report$plots$global report$plots$badges
Runs student_report over many examinees at once. A
lightweight numeric summary (posterior EAP of , mastery and
decision confidence per component and per rule) is always computed for
every requested student, since it only reads quantities already stored in
fit$EAP/fit$posterior$theta. The comparatively expensive
step – building the ggplot2 objects returned by
student_report – is only performed for the students in the
current page, so large batches stay cheap to page through.
student_report_batch( fit, Q, components, student_ids = NULL, offset = 0, limit = 10, y = 0.5, theta_cut = NULL, credible = 0.95, digits = 3 )student_report_batch( fit, Q, components, student_ids = NULL, offset = 0, limit = 10, y = 0.5, theta_cut = NULL, credible = 0.95, digits = 3 )
fit |
An object of class |
Q |
A |
components |
A named list grouping rules into components, identical
to the one used to fit |
student_ids |
Vector of examinee identifiers to include in the
batch, in either form accepted by |
offset |
Integer. Number of students in |
limit |
Integer. Maximum number of students in the current page
(i.e. with full reports/plots generated). Default is |
y, theta_cut, credible, digits
|
Passed through to
|
The current page covers
student_ids[(offset + 1):(offset + limit)]. If offset is at
or beyond length(student_ids), the page is empty (reports
has length 0) rather than an error; summary is unaffected, since it
always covers every requested student regardless of paging.
A list of class "GMLTM_batch_report" with elements:
summaryA data.frame with one row per requested
student (student, theta_<component>,
domain_<component>, confidence_<component> for each
component, and domain_rule_<rule>, confidence_rule_<rule>
for each rule), built without generating any plots.
reportsNamed list (by resolved student label) of full
student_report objects, including their plots,
for the students in the current page only.
pageA list with offset, limit, and
total (the number of requested students in student_ids).
Other diagnostic reporting functions:
extract_correlation(),
student_report()
if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) # First page: students 1-10 (summary covers all 149 examinees either way) page1 <- student_report_batch(fit, Q, components, limit = 10) page1 page1$reports[["1"]]$plots$badges # Next page: students 11-20, individual reports for students 1-10 are # still fully available in page1$reports page2 <- student_report_batch(fit, Q, components, offset = 10, limit = 10) page2$reports[["11"]]if (!requireNamespace("rstan", quietly = TRUE)) return() data(analogy) Q <- structure( c(0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1, 1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0, 0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1), dim = c(27L, 5L), dimnames = list(NULL, c("rot_fig","rot_trap","reflection", "subt_seg","mov_point"))) components <- list(global = c(1, 2, 3), local = c(4, 5)) fit <- GMLTM(analogy, Q, components, iters = 200, iter_warmup = 100, chains = 1, cores = 1) # First page: students 1-10 (summary covers all 149 examinees either way) page1 <- student_report_batch(fit, Q, components, limit = 10) page1 page1$reports[["1"]]$plots$badges # Next page: students 11-20, individual reports for students 1-10 are # still fully available in page1$reports page2 <- student_report_batch(fit, Q, components, offset = 10, limit = 10) page2$reports[["11"]]
Summary Method for Conditional Reliability Analysis
## S3 method for class 'conditional_reliability_tif' summary(object, digits = 3, ...)## S3 method for class 'conditional_reliability_tif' summary(object, digits = 3, ...)
object |
An object of class |
digits |
Integer. Number of decimal places to display. Default is |
... |
Currently unused. |
Invisibly returns object. Called for its side effect of
printing a formatted summary of conditional reliability statistics to the
console.