lsirm2pl integrates all functions related to 2PL LSIRM. Various 2PL LSIRM function can be used by setting the spikenslab, fixed_gamma, and missing_data arguments.
This function can be used regardless of the data type, providing a unified approach to model fitting.
lsirm2pl(
data,
spikenslab = FALSE,
fixed_gamma = FALSE,
missing_data = NA,
chains = 1,
multicore = 1,
seed = NA,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 0.2,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_sd_theta = 1,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
fix_theta_sd = FALSE,
fix_alpha_1 = TRUE,
adapt = NULL,
...
)lsirm2pl returns an object of list.
The basic return list containing the following components:
A data frame or matrix containing the variables used in the model.
A numeric value representing the Bayesian Information Criterion (BIC).
Details about the number of MCMC iterations, burn-in periods, and thinning intervals.
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs.
Posterior estimates of the beta parameter.
Posterior estimates of the theta parameter.
Posterior estimates of the standard deviation of theta.
posterior estimates of alpha parameter..
Posterior estimates of gamma parameter.
Posterior estimates of the z parameter.
Posterior estimates of the w parameter.
Posterior samples of the beta parameter.
Posterior samples of the theta parameter.
Posterior samples of the standard deviation of theta.
Posterior samples of the alpha parameter.
Posterior samples of the gamma parameter.
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space.
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space.
Acceptance ratio for the beta parameter.
Acceptance ratio for the theta parameter.
Acceptance ratio for the z parameter.
Acceptance ratio for the w parameter.
Acceptance ratio for the alpha parameter.
Acceptance ratio for the gamma parameter.
Additional return values for various settings. Refer to the functions in the Details.
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item.
Logical; specifies whether to use a model selection approach. Default is FALSE.
Logical; indicates whether to fix gamma at 1. Default is FALSE.
Character; the type of missing data assumed. Options are NA, "mar", or "mcar". Default is NA.
Integer; the number of MCMC chains to run. Default is 1.
Integer; the number of cores to use for parallel execution. Default is 1.
Integer; the seed number for MCMC fitting. Default is NA.
Integer; the dimension of the latent space. Default is 2.
Integer; the total number of MCMC iterations to run. Default is 15000.
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500.
Integer; the number of MCMC iterations to thin. Default is 5.
Integer; the interval at which MCMC samples are displayed during execution. Default is 500.
Numeric; the jumping rule for the beta proposal density. Default is 0.4.
Numeric; the jumping rule for the theta proposal density. Default is 1.
Numeric; the jumping rule for the alpha proposal density. Default is 1.
Numeric; the jumping rule for the gamma proposal density. Default is 0.2.
Numeric; the jumping rule for the z proposal density. Default is 0.5.
Numeric; the jumping rule for the w proposal density. Default is 0.5.
Numeric; the mean of the normal prior for beta. Default is 0.
Numeric; the standard deviation of the normal prior for beta. Default is 1.
Numeric; the mean of the normal prior for theta. Default is 0.
Numeric; the standard deviation of the normal prior for theta. Default is 1.
Numeric; mean of log normal prior for gamma. Default is 0.5.
Numeric; standard deviation of log normal prior for gamma. Default is 1.
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001.
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001.
Numeric; the mean of the log normal prior for alpha. Default is 0.5.
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.
Logical; If TRUE, the standard deviation of the theta parameter is fixed. Default is FALSE.
Logical; If TRUE, the first element of the alpha parameter is fixed to 1. Default is TRUE.
List; optional adaptive MCMC control. If not NULL, proposal standard deviations are adapted during the burn-in period to reach a target acceptance rate and are held fixed during the main MCMC sampling.
When adaptation is enabled, the reported acceptance ratios in the output (accept_beta, accept_theta, accept_alpha, etc.) are computed only from iterations after burn-in, reflecting the performance of the adapted proposal distributions.
Elements of the list can include:
use_adapt: Logical; if TRUE, adaptive MCMC is used. Default is FALSE.
adapt_interval: Integer; the number of iterations between each update of the proposal SDs. Default is 100.
adapt_rate: Numeric; Robbins-Monro scaling constant (c) in step size formula: adapt_rate / iteration^decay_rate. Default is 1.0. Valid range: any positive value. Recommended: 0.5-2.0.
decay_rate: Numeric; Robbins-Monro decay exponent (alpha) in step size formula. Default is 0.5. Valid range: (0.5, 1]. Recommended: 0.5-0.8.
target_accept: Numeric; target acceptance rate for scalar parameters (beta, theta, gamma, alpha). Default is 0.44.
target_accept_zw: Numeric; target acceptance rate for the multi-dimensional latent positions z and w. Default is 0.234 (optimal for high dimensions; Roberts, Gelman & Gilks, 1997).
target_accept_beta/theta/alpha/gamma: Numeric; (optional) parameter-specific target acceptance rates to override target_accept.
Additional arguments passed to the underlying model-fitting functions.
Additional arguments and return values for each function are documented in the respective function's description.
* For 2PL LSIRM with data included missing value are detailed in lsirm2pl_mar and lsirm2pl_mcar.
* For 2PL LSIRM using the spike-and-slab model selection approach are detailed in lsirm2pl_ss.
* For continuous version of 2PL LSIRM are detailed in lsirm2pl_normal_o.
For 2PL LSIRM with binary item response data, the probability of correct response by respondent \(j\) to item \(i\) with item effect \(\beta_i\), respondent effect \(\theta_j\) and the distance between latent position \(w_i\) of item \(i\) and latent position \(z_j\) of respondent \(j\) in the shared metric space, with \(\gamma\) represents the weight of the distance term. For 2pl model, the the item effect is assumed to have additional discrimination parameter \(\alpha_i\) multiplied by \(\theta_j\): $$logit(P(Y_{j,i} = 1|\theta_j,\alpha_i,\beta_i,\gamma,z_j,w_i))=\theta_j*\alpha_i+\beta_i-\gamma||z_j-w_i||$$
For 2PL LSIRM with continuous item response data, the continuous value of response by respondent \(j\) to item \(i\) with item effect \(\beta_i\), respondent effect \(\theta_j\) and the distance between latent position \(w_i\) of item \(i\) and latent position \(z_j\) of respondent \(j\) in the shared metric space, with \(\gamma\) represents the weight of the distance term. For 2pl model, the the item effect is assumed to have additional discrimination parameter \(\alpha_i\) multiplied by \(\theta_j\): $$Y_{j,i} = \theta_j+\beta_i-\gamma||z_j-w_i|| + e_{j,i}$$ where the error \(e_{j,i} \sim N(0,\sigma^2)\)
The 2PL LSIRM for binary item response data as following:
lsirm2pl_o, lsirm2pl_fixed_gamma, lsirm2pl_mar,lsirm2pl_mcar, lsirm2pl_fixed_gamma_mar, lsirm2pl_fixed_gamma_mcar, lsirm2pl_ss, lsirm2pl_mar_ss, and lsirm2pl_mcar_ss
The 2PL LSIRM for continuous item response data as following:
lsirm2pl_normal_o, lsirm2pl_normal_fixed_gamma, lsirm2pl_normal_mar, lsirm2pl_normal_mcar,lsirm1pl_normal_fixed_gamma_mar, lsirm2pl_normal_fixed_gamma_mcar, lsirm2pl_normal_ss, lsirm2pl_normal_mar_ss, lsirm2pl_normal_mcar_ss
# \donttest{
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
lsirm_result <- lsirm2pl(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data~lsirm2pl())
# Fit with adaptive MCMC
lsirm_result <- lsirm2pl(data, adapt = list(use_adapt = TRUE))
# }
Run the code above in your browser using DataLab