Type: | Package |
Title: | Latent Space Item Response Model |
Version: | 1.3.5 |
Date: | 2025-07-08 |
Maintainer: | Gwanghee Kim <musagh08@yonsei.ac.kr> |
Description: | Analysis of dichotomous and continuous response data using latent factor by both 1PL LSIRM and 2PL LSIRM as described in Jeon et al. (2021) <doi:10.1007/s11336-021-09762-5>. It includes original 1PL LSIRM and 2PL LSIRM provided for binary response data and its extension for continuous response data. Bayesian model selection with spike-and-slab prior and method for dealing data with missing value under missing at random, missing completely at random are also supported. Various diagnostic plots are available to inspect the latent space and summary of estimated parameters. |
License: | GPL-3 |
Imports: | Rcpp (≥ 1.0.5), MCMCpack, ggplot2, GPArotation, dplyr (≥ 1.1.4), grDevices, rlang, pROC, coda, spatstat, spatstat.geom, spatstat.random, plotly, gridExtra, grid, tidyr, fpc, kernlab, plyr, purrr |
LinkingTo: | Rcpp, RcppArmadillo |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
Suggests: | knitr, testthat |
Depends: | R (≥ 3.1.0) |
LazyData: | true |
NeedsCompilation: | yes |
Packaged: | 2025-07-08 02:10:43 UTC; gwangheekim |
Author: | Dongyoung Go [aut], Gwanghee Kim [aut, cre], Jina Park [aut], Ickhoon Jin [ctb], Minjeong Jeon [ctb] |
Repository: | CRAN |
Date/Publication: | 2025-07-08 02:40:02 UTC |
Big Five Personality Test
Description
A dataset containing the result of personality test for 50 questions from 1,000 random sampled people.
Usage
data(BFPT)
Format
A matrix with 1,015,341 rows and 50 columns.
Details
A dataset collected in 2016-2018 through an interactive on-line personality test, containing the result of personality test for 50 questions. 1,000 people are random sampled from the original dataset containing 1,015,341 people. The scale is labeled as 1=Disagree, 3=Neutral and 5=Agree.
Source
https://www.kaggle.com/tunguz/big-five-personality-test
Inductive Reasoning Developmental Test
Description
TDRI dataset is the answer to Inductive Reasoning Developmental Test of 1,803 Brazilians with age varying from 5 to 85 years.
Usage
data(TDRI)
Format
A binary matrix with 1,803 rows and 56 columns.
Details
It presents data from 1,803 Brazilians (52.5% female) with age varying from 5 to 85 years (M = 15.75; SD = 12.21) that answered to the Inductive Reasoning Developmental Test – IRDT, with 56 items designed to assess developmentally sequenced and hierarchically organized inductive reasoning.
Source
https://figshare.com/articles/dataset/TDRI_dataset_csv/3142321
Diagnostic the result of LSIRM.
Description
diagnostic
checks the convergence of MCMC for LSIRM parameters using various diagnostic tools, such as trace plots, posterior density distributions, autocorrelation functions (ACF), and Gelman-Rubin-Brooks plots.
Usage
diagnostic(
object,
draw.item = list(beta = c(1), theta = c(1)),
gelman.diag = FALSE
)
Arguments
object |
Object of class |
draw.item |
List; Each key in the list corresponds to a specific parameters such as "beta", "theta", "gamma", "alpha", "theta_sd", "sigma" and "zw.dist". The values of the list indicate the indices of these parameters. For the key "zw.dist", the value is a matrix with two columns: the first column represents the indices of respondents, and the second column represents the indices of items. |
gelman.diag |
Logical; If TRUE, the Gelman-Rubin convergence diagnostic will be printed. Default is FALSE. |
Value
diagnostic
returns plots for checking MCMC convergence for selected parameters.
Examples
# Generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5), ncol=10, nrow=50)
# For 1PL LSIRM
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = FALSE))
diagnostic(lsirm_result)
# For 2PL LSIRM
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = FALSE))
diagnostic(lsirm_result)
Goodness-of-fit LSIRM
Description
gof is goodness-of-fit the latent space of fitted LSIRM.
Usage
gof(object, chain.idx = 1)
Arguments
object |
Object of class |
chain.idx |
Numeric; Index of MCMC chain. Default is 1. |
Value
gof
returns the boxplot or AUC plot
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
lsirm_result <- lsirm(data ~ lsirm1pl())
gof(lsirm_result)
Fit a LSIRM ( Latent Space Item Response Model)
Description
lsirm is used to fit 1PL LSIRM and 2PL LSIRM using Bayesian method as described in Jeon et al. (2021).
Usage
lsirm(formula, ...)
Arguments
formula |
The form of formula is |
... |
Additional arguments for the corresponding function. |
Details
The descriptions of options for each model, such as <term 2>
and <term 3>
, are included in lsirm1pl
for 1PL LSIRM and lsirm2pl
for 2PL LSIRM.
Value
lsirm
returns an object of class list
.
See corresponding functions such as lsirm1pl
for 1PL LSIRM and lsirm2pl
for 2PL LSIRM.
See Also
lsirm1pl
for 1PL LSIRM.
lsirm2pl
for 2PL LSIRM.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
lsirm_result <- lsirm(data~lsirm1pl())
lsirm_result <- lsirm(data~lsirm2pl())
Formula function for LSIRM
Description
lsirm.formula is formula object.
Usage
## S3 method for class 'formula'
lsirm(formula, ...)
Arguments
formula |
The form of formula is |
... |
Additional arguments for the corresponding function. |
lsirm12pl-package
Description
Analysis of dichotomous and continuous response data using latent factor by both 1PL LSIRM and 2PL LSIRM as described in Jeon et al. (2021) <doi:10.1007/s11336-021-09762-5>. It includes original 1PL LSIRM and 2PL LSIRM provided for binary response data and its extension for continuous response data. Bayesian model selection with spike-and-slab prior and method for dealing data with missing value under missing at random, missing completely at random are also supported. Various diagnostic plots are available to inspect the latent space and summary of estimated parameters.
Fit a 1PL LSIRM for binary and continuous item response data
Description
lsirm1pl
integrates all functions related to 1PL LSIRM. Various 1PL 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.
Usage
lsirm1pl(
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_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
...
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
spikenslab |
Logical; specifies whether to use a model selection approach. Default is FALSE. |
fixed_gamma |
Logical; indicates whether to fix gamma at 1. Default is FALSE. |
missing_data |
Character; the type of missing data assumed. Options are NA, "mar", or "mcar". Default is NA. |
chains |
Integer; the number of MCMC chains to run. Default is 1. |
multicore |
Integer; the number of cores to use for parallel execution. Default is 1. |
seed |
Integer; the seed number for MCMC fitting. Default is NA. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
... |
Additional arguments for the for various settings. Refer to the functions in the Details. |
Details
Additional arguments and return values for each function are documented in the respective function's description.
* For LSIRM with data included missing value are detailed in lsirm1pl_mar and lsirm1pl_mcar.
* For LSIRM using the spike-and-slab model selection approach are detailed in lsirm1pl_ss.
* For continuous version of LSIRM are detailed in lsirm1pl_normal_o.
For 1PL 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:
logit(P(Y_{j,i} = 1|\theta_j,\beta_i,\gamma,z_j,w_i))=\theta_j+\beta_i-\gamma||z_j-w_i||
For 1PL 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:
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)
.
Value
lsirm1pl
returns an object of list.
The basic return list containing the following components:
data |
A data frame or matrix containing the variables used in the model. |
bic |
A numeric value representing the Bayesian Information Criterion (BIC). |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
... |
Additional return values for various settings. Refer to the functions in the Details. |
Note
If both spikenslab
and fixed_gamma
are set TRUE
, it returns error because both are related to gamma
.
See Also
The LSIRM for 1PL LSIRM for binary item response data as following:
lsirm1pl_o
, lsirm1pl_fixed_gamma
, lsirm1pl_mar
,lsirm1pl_mcar
, lsirm1pl_fixed_gamma_mar
, lsirm1pl_fixed_gamma_mcar
, lsirm1pl_ss
, lsirm1pl_mar_ss
, and lsirm1pl_mcar_ss
The LSIRM for 1PL LSIRM for continuous item response data as following:
lsirm1pl_normal_o
, lsirm1pl_normal_fixed_gamma
, lsirm1pl_normal_mar
, lsirm1pl_normal_mcar
,lsirm1pl_normal_fixed_gamma_mar
, lsirm1pl_normal_fixed_gamma_mcar
, lsirm1pl_normal_ss
, lsirm1pl_normal_mar_ss
, lsirm1pl_normal_mcar_ss
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
lsirm_result <- lsirm1pl(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data~lsirm1pl())
1PL LSIRM fixing gamma to 1.
Description
lsirm1pl_fixed_gamma is used to fit 1PL LSIRM with gamma fixed to 1. lsirm1pl_fixed_gamma factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_fixed_gamma(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_fixed_gamma
models 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:
logit(P(Y_{j,i} = 1|\theta_j,\beta_i,z_j,w_i))=\theta_j+\beta_i-||z_j-w_i||
Value
lsirm1pl_fixed_gamma
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
lsirm_result <- lsirm1pl_fixed_gamma(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = TRUE))
1PL LSIRM fixing gamma to 1 for missing at random data.
Description
lsirm1pl_fixed_gamma_mar is used to fit LSIRM with gamma fixed to 1 in incomplete data assumed to be missing at random. lsirm1pl_fixed_gamma_mar factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while considering the missing element under the assumption of missing at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_fixed_gamma_mar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_fixed_gamma_mar
models 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:
logit(P(Y_{j,i} = 1|\theta_j,\beta_i,z_j,w_i))=\theta_j+\beta_i-||z_j-w_i||
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References.
Value
lsirm1pl_fixed_gamma_mar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
imp_estimate |
Probability of imputating a missing value with 1. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_fixed_gamma_mar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = TRUE,
missing_data = "mar", missing.val = 99))
1PL LSIRM fixing gamma to 1 for missing completely at random data.
Description
lsirm1pl_fixed_gamma_mcar is used to fit LSIRM with gamma fixed to 1 in incomplete data assumed to be missing completely at random. lsirm1pl_fixed_gamma_mcar factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_fixed_gamma_mcar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_fixed_gamma_mcar
models 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:
logit(P(Y_{j,i} = 1|\theta_j,\beta_i,z_j,w_i))=\theta_j+\beta_i-||z_j-w_i||
Under the assumption of missing completely at random, the model ignores the missing element in doing inference. For the details of missing completely at random assumption and data augmentation, see References.
Value
lsirm1pl_fixed_gamma_mcar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_fixed_gamma_mcar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = TRUE,
missing_data = "mcar", missing.val = 99))
1PL LSIRM for missing at random data.
Description
lsirm1pl_mar is used to fit 1PL LSIRM in incomplete data assumed to be missing at random. lsirm1pl_mar factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while considering the missing element under the assumption of missing at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_mar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 0.025,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025 |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_mar
models 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:
logit(P(Y_{j,i} = 1|\theta_j,\beta_i,\gamma,z_j,w_i))=\theta_j+\beta_i-\gamma||z_j-w_i||
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References.
Value
lsirm1pl_mar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
imp_estimate |
Probability of imputating a missing value with 1. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_mar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = FALSE,
missing_data ='mar', missing.val = 99))
1PL LSIRM with model selection approach for missing at random data.
Description
lsirm1pl_mar_ss is used to fit 1PL LSIRM with model selection approach based on spike-and-slab priors in incomplete data assumed to be missing at random. lsirm1pl_mar_ss factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while considering the missing element under the assumption of missing at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_mar_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_xi_a = 1,
pr_xi_b = 1,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; the mean of spike prior for log gamma. Default is -3. |
pr_spike_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_slab_mean |
Numeric; the mean of spike prior for log gamma. Default is 0.5. |
pr_slab_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is is 1. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_xi_a |
Numeric; the first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; the second shape parameter of beta prior for latent variable xi. Default is 1. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_mar_ss
models 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:
logit(P(Y_{j,i} = 1 |\theta_j,\beta_i,\gamma,z_j,w_i))=\theta_j+\beta_i-\gamma||z_j-w_i||
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References. lsirm1pl_mar_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm1pl_mar_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
pi |
Posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
pi_estimate |
Posterior estimation of phi. inclusion probability of gamma. if estimation of phi is less than 0.5, choose Rasch model with gamma = 0, otherwise latent space model with gamma > 0. |
imp_estimate |
Probability of imputating a missing value with 1. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons. Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: frequentist and Bayesian strategies. The Annals of Statistics, 33(2), 730-773.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_mar_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = TRUE, fixed_gamma = FALSE,
missing_data = 'mar', missing = 99))
1PL LSIRM for missing completely at random data.
Description
lsirm1pl_mcar is used to fit 1PL LSIRM in incomplete data assumed to be missing completely at random. lsirm1pl_mcar factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_mcar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 0.025,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
missing.val |
Numeric; A number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_mcar
models 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:
logit(P(Y_{j,i} = 1|\theta_j,\beta_i,\gamma,z_j,w_i))=\theta_j+\beta_i-\gamma||z_j-w_i||
Under the assumption of missing completely at random, the model ignores the missing element in doing inference. For the details of missing completely at random assumption and data augmentation, see References.
Value
lsirm1pl_mcar
returns an object of list containing the following components:
data |
A data frame or matrix containing the variables used in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
Posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
gamma |
Posterior samples of the gamma parameter. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_mcar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = FALSE,
missing_data ='mcar', missing.val = 99))
1PL LSIRM with model selection approach for missing completely at random data.
Description
lsirm1pl_mcar_ss is used to fit 1PL LSIRM with model selection approach based on spike-and-slab priors in incomplete data assumed to be missing completely at random. lsirm1pl_mcar_ss factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_mcar_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_xi_a = 1,
pr_xi_b = 1,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; the mean of spike prior for log gamma. Default is -3. |
pr_spike_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_slab_mean |
Numeric; the mean of spike prior for log gamma. Default is 0.5. |
pr_slab_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_xi_a |
Numeric; the first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; the second shape parameter of beta prior for latent variable xi. Default is 1. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_mcar_ss
models 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:
logit(P(Y_{j,i} = 1 |\theta_j,\beta_i,\gamma,z_j,w_i))=\theta_j+\beta_i-\gamma||z_j-w_i||
Under the assumption of missing completely at random, the model ignores the missing element in doing inference. For the details of missing completely at random assumption and data augmentation, see References. lsirm1pl_mcar_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm1pl_mcar_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
pi |
Posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons. Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: frequentist and Bayesian strategies. The Annals of Statistics, 33(2), 730-773.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_mcar_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = TRUE, fixed_gamma = FALSE,
missing_data ='mcar', missing.val = 99))
1PL LSIRM fixing gamma to 1 with normal likelihood
Description
lsirm1pl_normal_fixed_gamma is used to fit 1PL LSIRM for continuous variable with gamma fixed to 1. lsirm1pl_normal_fixed_gamma factorizes continuous item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while ignoring the missing element under the assumption of missing at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_normal_fixed_gamma(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood Default is 0.001. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_normal_fixed_gamma
models 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:
Y_{j,i} = \theta_j+\beta_i-||z_j-w_i|| + e_{j,i}
where the error e_{j,i} \sim N(0,\sigma^2)
.
Value
lsirm1pl_normal_fixed_gamma
returns an object of list containing the following components:
data |
A data frame or matrix containing the variables used in the model. |
bic |
A numeric value representing the Bayesian Information Criterion (BIC). |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_normal_fixed_gamma(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = TRUE))
1PL LSIRM fixing gamma to 1 with normal likelihood for missing at random data.
Description
lsirm1pl_normal_fixed_gamma_mar is used to fit 1PL LSIRM for continuous variable with gamma fixed to 1 in incomplete data assumed to be missing at random.
lsirm1pl_normal_fixed_gamma_mar factorizes continuous item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while considering the missing element under the assumption of missing at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_normal_fixed_gamma_mar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood Default is 0.001. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_normal_fixed_gamma_mar
models 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:
Y_j,i = \theta_j+\beta_i-||z_j-w_i|| + e_{ji}
where the error e_ji ~ N(0,\sigma^2)
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References.
Value
lsirm1pl_normal_fixed_gamma_mar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
imp_estimate |
Probability of imputating a missing value with 1. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_normal_fixed_gamma_mar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = TRUE,
missing_data = "mar", missing.val = 99))
1PL LSIRM fixing gamma to 1 with normal likelihood for missing completely at random data.
Description
lsirm1pl_normal_fixed_gamma_mcar is used to fit 1PL LSIRM for continuous variable with gamma fixed to 1 in incomplete data assumed to be missing completely at random.
lsirm1pl_normal_fixed_gamma_mcar factorizes continuous item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_normal_fixed_gamma_mcar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_normal_fixed_gamma_mcar
models 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:
Y_{j,i} = \theta_j+\beta_i-||z_j-w_i|| + e_{j,i}
where the error e_{j,i} \sim N(0,\sigma^2)
Under the assumption of missing completely at random, the model ignores the missing element in doing inference. For the details of missing completely at random assumption and data augmentation, see References.
Value
lsirm1pl_normal_fixed_gamma_mcar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_normal_fixed_gamma_mcar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = TRUE,
missing_data = "mcar", missing.val = 99))
1PL LSIRM with normal likelihood for missing at random data.
Description
lsirm1pl_normal_mar is used to fit LSIRM for continuous variable with 1pl in incomplete data assumed to be missing at random. lsirm1pl_normal_mar factorizes continuous item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while considering the missing element under the assumption of missing at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_normal_mar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025 |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_normal_mar
models 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:
Y_j,i = \theta_j+\beta_i-\gamma||z_j-w_i|| + e_{ji}
where the error e_{ji} \sim N(0,\sigma^2)
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References.
Value
lsirm1pl_normal_mar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
imp_estimate |
Probability of imputating a missing value with 1. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_normal_mar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = FALSE,
missing_data ='mar', missing.val = 99))
1PL LSIRM with normal likelihood and model selection approach for missing at random data.
Description
lsirm1pl_normal_mar_ss is used to fit 1PL LSIRM with model selection approach based on spike-and-slab priors for continuous variable with 1pl in incomplete data assumed to be missing at random. lsirm1pl_normal_mar_ss factorizes continuous item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while considering the missing element under the assumption of missing at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_normal_mar_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
pr_xi_a = 0.001,
pr_xi_b = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; the mean of spike prior for log gamma. Default is -3. |
pr_spike_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_slab_mean |
Numeric; the mean of spike prior for log gamma. Default is 0.5. |
pr_slab_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is is 1. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood Default is 0.001. |
pr_xi_a |
Numeric; the first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; the second shape parameter of beta prior for latent variable xi. Default is 1. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_normal_mar_ss
models 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:
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)
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References. lsirm1pl_normal_mar_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm1pl_normal_mar_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
pi |
Posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
pi_estimate |
Posterior estimation of phi. inclusion probability of gamma. if estimation of phi is less than 0.5, choose Rasch model with gamma = 0, otherwise latent space model with gamma > 0. |
imp_estimate |
Probability of imputating a missing value with 1. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons. Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: frequentist and Bayesian strategies. The Annals of Statistics, 33(2), 730-773.
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_normal_mar_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = TRUE, fixed_gamma = FALSE,
missing_data = 'mar', missing = 99))
1PL LSIRM with normal likelihood for missing completely at random data.
Description
lsirm1pl_normal_mcar is used to fit LSIRM with 1pl in incomplete data assumed to be missing completely at random. lsirm1pl_normal_mcar factorizes continuous item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_normal_mcar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025 |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_normal_mcar
models 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:
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)
Under the assumption of missing completely at random, the model ignores the missing element in doing inference. For the details of missing at random assumption and data augmentation, see References.
Value
lsirm1pl_normal_mcar
returns an object of list containing the following components:
data |
A data frame or matrix containing the variables used in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
Posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
gamma |
Posterior samples of the gamma parameter. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_normal_mcar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = FALSE,
missing_data ='mcar', missing.val = 99))
1PL LSIRM with normal likelihood and model selection approach for missing completely at random data.
Description
lsirm1pl_normal_mcar_ss is used to fit LSIRM with model selection approach based on spike-and-slab priors for continuous variable with 1pl in incomplete data assumed to be missing completely at random. lsirm1pl_normal_mcar_ss factorizes continuous item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_normal_mcar_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
pr_xi_a = 0.001,
pr_xi_b = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; the mean of spike prior for log gamma. Default is -3. |
pr_spike_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_slab_mean |
Numeric; the mean of spike prior for log gamma. Default is 0.5. |
pr_slab_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is is 1. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_xi_a |
Numeric; the first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; the second shape parameter of beta prior for latent variable xi. Default is 1. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_normal_mcar_ss
models 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:
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)
. Under the assumption of missing completely at random, the model ignores the missing element in doing inference. For the details of missing at random assumption and data augmentation, see References. lsirm1pl_normal_mcar_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm1pl_normal_mcar_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
pi |
Posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons. Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: frequentist and Bayesian strategies. The Annals of Statistics, 33(2), 730-773.
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm1pl_normal_mcar_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = TRUE, fixed_gamma = FALSE,
missing_data ='mcar', missing.val = 99))
1PL LSIRM with normal likelihood.
Description
lsirm1pl_normal_o is used to fit LSIRM for continuous variable with 1pl. lsirm1pl_normal_o factorizes continuous item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_normal_o(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025 |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_normal_o
models 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:
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)
.
Value
lsirm1pl_normal_o
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables used in the model. |
bic |
A numeric value representing the Bayesian Information Criterion (BIC). |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
Posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
gamma |
Posterior samples of the gamma parameter. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
lsirm_result <- lsirm1pl_normal_o(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = FALSE))
1PL LSIRM with normal likelihood and model selection approach.
Description
lsirm1pl_normal_ss is used to fit LSIRM with model selection approach based on spike-and-slab priors for continuous variable with 1pl. LSIRM factorizes continuous item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_normal_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
pr_xi_a = 0.001,
pr_xi_b = 0.001,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; mean of spike prior for log gamma default value is -3. |
pr_spike_sd |
Numeric; standard deviation of spike prior for log gamma default value is 1. |
pr_slab_mean |
Numeric; mean of spike prior for log gamma default value is 0.5. |
pr_slab_sd |
Numeric; standard deviation of spike prior for log gamma default value is 1. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_xi_a |
Numeric; first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; second shape parameter of beta prior for latent variable xi. Default is 1. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_normal_ss
models 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:
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)
. lsrm1pl_noraml_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm1pl_normal_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
number of mcmc iteration, burn-in periods, and thinning intervals. |
map_inf |
value of log maximum a posterior and iteration number which have log maximum a posterior. |
beta_estimate |
posterior estimation of beta. |
theta_estimate |
posterior estimation of theta. |
sigma_theta_estimate |
posterior estimation of standard deviation of theta. |
sigma_estimate |
posterior estimation of standard deviation. |
gamma_estimate |
posterior estimation of gamma. |
z_estimate |
posterior estimation of z. |
w_estimate |
posterior estimation of w. |
pi_estimate |
posterior estimation of phi. inclusion probability of gamma. if estimation of phi is less than 0.5, choose Rasch model with gamma = 0, otherwise latent space model with gamma > 0. |
beta |
posterior samples of beta. |
theta |
posterior samples of theta. |
theta_sd |
posterior samples of standard deviation of theta. |
sigma |
posterior samples of standard deviation. |
gamma |
posterior samples of gamma. |
z |
posterior samples of z. The output is 3-dimensional matrix with last axis represent the dimension of latent space. |
w |
posterior samples of w. The output is 3-dimensional matrix with last axis represent the dimension of latent space. |
pi |
posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
accept_beta |
accept ratio of beta. |
accept_theta |
accept ratio of theta. |
accept_w |
accept ratio of w. |
accept_z |
accept ratio of z. |
accept_gamma |
accept ratio of gamma. |
References
Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: Frequentist and Bayesian strategies (Vol. 33). The Annals of Statistics
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
lsirm_result <- lsirm1pl_normal_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = TRUE, fixed_gamma = FALSE))
1PL LSIRM.
Description
lsirm1pl_o is used to fit 1PL LSIRM. lsirm1pl_o factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_o(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 0.025,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_o
models 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:
logit(P(Y_{j,i} = 1|\theta_j,\beta_i,\gamma,z_j,w_i))=\theta_j+\beta_i-\gamma||z_j-w_i||
Value
lsirm1pl_o
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables used in the model. |
bic |
A numeric value representing the Bayesian Information Criterion (BIC). |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
Posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
gamma |
Posterior samples of the gamma parameter. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
lsirm_result <- lsirm1pl_o(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = FALSE, fixed_gamma = FALSE))
1PL LSIRM with model selection approach.
Description
lsirm1pl_ss is used to fit 1PL LSIRM with model selection approach based on spike-and-slab priors. LSIRM factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm1pl_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_xi_a = 1,
pr_xi_b = 1,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; the mean of spike prior for log gamma. Default is -3. |
pr_spike_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_slab_mean |
Numeric; the mean of spike prior for log gamma. Default is 0.5. |
pr_slab_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is is 1. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_xi_a |
Numeric; the first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; the second shape parameter of beta prior for latent variable xi. Default is 1. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm1pl_ss
models 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:
logit(P(Y_{j,i} = 1|\theta_j,\beta_i,\gamma,z_j,w_i))=\theta_j+\beta_i-\gamma||z_j-w_i||
lsirm1pl_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm1pl_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables used in the model. |
bic |
A numeric value representing the Bayesian Information Criterion (BIC). |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
Posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
gamma |
Posterior samples of the gamma parameter. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
pi_estimate |
Posterior estimation of phi. inclusion probability of gamma. if estimation of phi is less than 0.5, choose Rasch model with gamma = 0, otherwise latent space model with gamma > 0. |
pi |
Posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
References
Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: Frequentist and Bayesian strategies (Vol. 33). The Annals of Statistics
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
lsirm_result <- lsirm1pl_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm1pl(spikenslab = TRUE, fixed_gamma = FALSE))
Fit a 2pl LSIRM for binary and continuous item resopnse data
Description
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.
Usage
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_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
...
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
spikenslab |
Logical; specifies whether to use a model selection approach. Default is FALSE. |
fixed_gamma |
Logical; indicates whether to fix gamma at 1. Default is FALSE. |
missing_data |
Character; the type of missing data assumed. Options are NA, "mar", or "mcar". Default is NA. |
chains |
Integer; the number of MCMC chains to run. Default is 1. |
multicore |
Integer; the number of cores to use for parallel execution. Default is 1. |
seed |
Integer; the seed number for MCMC fitting. Default is NA. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
... |
Additional arguments for the for various settings. Refer to the functions in the Details. |
Details
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)
Value
lsirm2pl
returns an object of list.
The basic return list containing the following components:
data |
A data frame or matrix containing the variables used in the model. |
bic |
A numeric value representing the Bayesian Information Criterion (BIC). |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
alpha_estimate |
posterior estimates of alpha parameter.. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
alpha |
Posterior samples of the alpha parameter. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
... |
Additional return values for various settings. Refer to the functions in the Details. |
Note
If both spikenslab
and fixed_gamma
are set TRUE
, it returns error because both are related to gamma
.
See Also
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
Examples
# 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())
2PL LSIRM fixing gamma to 1.
Description
lsirm2pl_fixed_gamma is used to fit 2PL LSIRM fixing gamma to 1. lsirm2pl_fixed_gamma factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_fixed_gamma(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_fixed_gamma
models 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. 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,z_j,w_i))=\theta_j*\alpha_i+\beta_i-||z_j-w_i||
Value
lsirm2pl_fixed_gamma
returns an object of list containing the following components:
lsirm1pl_fixed_gamma
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
lsirm_result <- lsirm2pl_fixed_gamma(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = TRUE))
2PL LSIRM fixing gamma to 1 for missing at random data.
Description
lsirm2pl_fixed_gamma_mar is used to fit 2PL LSIRM fixing gamma to 1 in incomplete data assumed to be missing at random. lsirm2pl_fixed_gamma_mar factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while considering the missing element under the assumption of missing at random. Unlike 1pl model, 2pl model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_fixed_gamma_mar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
missing.val |
Numeric; A number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_fixed_gamma_mar
models 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. 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,z_j,w_i))=\theta_j*\alpha_i+\beta_i-||z_j-w_i||
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References.
Value
lsirm2pl_fixed_gamma_mar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
imp_estimate |
Probability of imputating a missing value with 1. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_fixed_gamma_mar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = TRUE,
missing_data = "mar"))
2PL LSIRM fixing gamma to 1 for missing completely at random data.
Description
lsirm2pl_fixed_gamma_mcar is used to fit 2PL LSIRM fixing gamma to 1 in incomplete data assumed to be missing completely at random. lsirm2pl_fixed_gamma_mcar factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. Unlike 1pl model, 2pl model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_fixed_gamma_mcar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
missing.val |
Numeric; A number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_fixed_gamma_mcar
models 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. 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,z_j,w_i))=\theta_j*\alpha_i+\beta_i-||z_j-w_i||
Under the assumption of missing completely at random, the model ignores the missing element in doing inference. For the details of missing completely at random assumption and data augmentation, see References.
Value
lsirm2pl_fixed_gamma_mar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_fixed_gamma_mcar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = TRUE,
missing_data = "mcar"))
2PL LSIRM for missing at random data.
Description
lsirm2pl_mar is used to fit 2PL LSIRM in incomplete data assumed to be missing at random. lsirm2pl_mar factorizes item response matrix into column-wise item effect, row-wise respondent effect in a latent space, while considering the missing element under the assumption of missing at random. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_mar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 0.025,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
missing.val |
Numeric; A number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_mar
models the probability of correct response by respondent j
to item i
with item effect \beta_i
, respondent effect \theta_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||
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References.
Value
lsirm2pl_mar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
imp_estimate |
Probability of imputating a missing value with 1. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5), ncol=10, nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2), ncol=10, nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_mar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = FALSE,
missing_data = "mar"))
2PL LSIRM with model selection approach for missing at random data.
Description
lsirm2pl_mar_ss is used to fit 2PL LSIRM based on spike-and-slab priors in incomplete data assumed to be missing at random. lsirm2pl_mar_ss factorizes item response matrix into column-wise item effect, row-wise respondent effect in a latent space, while considering the missing element under the assumption of missing at random. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_mar_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_xi_a = 1,
pr_xi_b = 1,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; the mean of spike prior for log gamma. Default is -3. |
pr_spike_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_slab_mean |
Numeric; the mean of spike prior for log gamma. Default is 0.5. |
pr_slab_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is is 1. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_xi_a |
Numeric; the first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; the second shape parameter of beta prior for latent variable xi. Default is 1. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_mar_ss
models the probability of correct response by respondent j
to item i
with item effect \beta_i
, respondent effect \theta_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||
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References. lsirm2pl_mar_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm2pl_mar_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
pi |
Posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
pi_estimate |
Posterior estimation of phi. inclusion probability of gamma. if estimation of phi is less than 0.5, choose Rasch model with gamma = 0, otherwise latent space model with gamma > 0. |
imp_estimate |
Probability of imputating a missing value with 1. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons. Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: Frequentist and Bayesian strategies. The Annals of Statistics, 33(2), 730-773.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5), ncol=10, nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2), ncol=10, nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_mar_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = TRUE, fixed_gamma = FALSE,
missing_data = "mar"))
2PL LSIRM for missing completely at random data.
Description
lsirm2pl_mcar is used to fit 2PL LSIRM in incomplete data assumed to be missing completely at random. lsirm2pl_mcar factorizes item response matrix into column-wise item effect, row-wise respondent effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_mcar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 0.025,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025 |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
missing.val |
Numeric; A number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_mcar
models the probability of correct response by respondent j
to item i
with item effect \beta_i
, respondent effect \theta_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||
Under the assumption of missing completely at random, the model ignores the missing element in doing inference. For the details of missing completely at random assumption and data augmentation, see References.
Value
lsirm2pl_mar
returns an object of list containing the following components:
data |
A data frame or matrix containing the variables used in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
Posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
gamma |
Posterior samples of the gamma parameter. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5), ncol=10, nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2), ncol=10, nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_mcar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = FALSE,
missing_data = "mcar"))
2PL LSIRM with model selection approach for missing completely at random data.
Description
lsirm2pl_mar_ss is used to fit 2PL LSIRM based on spike-and-slab priors in incomplete data assumed to be missing completely at random. lsirm2pl_mar_ss factorizes item response matrix into column-wise item effect, row-wise respondent effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_mcar_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_xi_a = 1,
pr_xi_b = 1,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; the mean of spike prior for log gamma. Default is -3. |
pr_spike_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_slab_mean |
Numeric; the mean of spike prior for log gamma. Default is 0.5. |
pr_slab_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_xi_a |
Numeric; the first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; the second shape parameter of beta prior for latent variable xi. Default is 1. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_mcar_ss
models the probability of correct response by respondent j
to item i
with item effect \beta_i
, respondent effect \theta_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||
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References. lsirm2pl_mcar_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm2pl_mar_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
pi |
Posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons. Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: Frequentist and Bayesian strategies. The Annals of Statistics, 33(2), 730-773.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5), ncol=10, nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2), ncol=10, nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_mcar_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = TRUE, fixed_gamma = FALSE,
missing_data = "mcar"))
2PL LSIRM fixing gamma to 1 with normal likelihood
Description
lsirm2pl_normal_fixed_gamma is used to fit 2PL LSIRM with gamma fixed to 1 for continuous variable. lsirm2pl_normal_fixed_gamma factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_normal_fixed_gamma(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_normal_fixed_gamma
models 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. 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)
Value
lsirm2pl_normal_fixed_gamma
returns an object of list containing the following components:
data |
A data frame or matrix containing the variables used in the model. |
bic |
A numeric value representing the Bayesian Information Criterion (BIC). |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
lsrm_result <- lsirm2pl_normal_fixed_gamma(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = TRUE))
2PL LSIRM fixing gamma to 1 with normal likelihood for missing at random data.
Description
lsirm2pl_normal_fixed_gamma_mar is used to fit 2PL LSIRM with gamma fixed to 1 for continuous variable in incomplete data assumed to be missing at random.
lsirm2pl_normal_fixed_gamma_mar factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while considering the missing element under the assumption of missing at random. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_normal_fixed_gamma_mar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood Default is 0.001. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_normal_fixed_gamma_mar
models 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. 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)
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References.
Value
lsirm2pl_normal_fixed_gamma_mar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
imp_estimate |
Probability of imputating a missing value with 1. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_normal_fixed_gamma_mar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = TRUE,
missing_data = "mar"))
2PL LSIRM fixing gamma to 1 with normal likelihood for missing completely at random data.
Description
lsirm2pl_normal_fixed_gamma_mcar is used to fit 2PL LSIRM with gamma fixed to 1 for continuous variable in incomplete data assumed to be missing completely at random.
lsirm2pl_normal_fixed_gamma_mcar factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_normal_fixed_gamma_mcar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_normal_fixed_gamma_mcar
models 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. 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)
Under the assumption of missing completely at random, the model ignores the missing element in doing inference. For the details of missing completely at random assumption and data augmentation, see References.
Value
lsirm2pl_normal_fixed_gamma_mcar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_normal_fixed_gamma_mcar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = TRUE,
missing_data = "mcar"))
2PL LSIRM with normal likelihood and missing at random data.
Description
lsirm2pl_normal_mar is used to fit 2PL LSIRM for continuous variable in incomplete data assumed to be missing at random. lsirm2pl_normal_mar factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while considering the missing element under the assumption of missing at random. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_normal_mar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025 |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_normal_mar
models 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)
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References.
Value
lsirm2pl_normal_mar
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
imp_estimate |
Probability of imputating a missing value with 1. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_normal_mar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = FALSE,
missing_data = "mar"))
2pl LSIRM with normal likelihood and model selection approach for missing at random data.
Description
lsirm2pl_normal_mar_ss is used to fit 2pl LSIRM with model selection approach based on spike-and-slab priors for continuous variable in incomplete data assumed to be missing at random. lsirm2pl_normal_mar_ss factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while considering the missing element under the assumption of missing at random. Unlike 1pl model, 2pl model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_normal_mar_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_xi_a = 0.001,
pr_xi_b = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; the mean of spike prior for log gamma. Default is -3. |
pr_spike_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_slab_mean |
Numeric; the mean of spike prior for log gamma. Default is 0.5. |
pr_slab_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is is 1. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood Default is 0.001. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_xi_a |
Numeric; the first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; the second shape parameter of beta prior for latent variable xi. Default is 1. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_normal_mar_ss
models 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)
Under the assumption of missing at random, the model takes the missing element into consideration in the sampling procedure. For the details of missing at random assumption and data augmentation, see References. lsirm2pl_normal_mcar_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm2pl_normal_mar_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
pi |
Posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
imp |
Imputation for missing Values using posterior samples. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
pi_estimate |
Posterior estimation of phi. inclusion probability of gamma. if estimation of phi is less than 0.5, choose Rasch model with gamma = 0, otherwise latent space model with gamma > 0. |
imp_estimate |
Probability of imputating a missing value with 1. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons. Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: Frequentist and Bayesian strategies. The Annals of Statistics, 33(2), 730-773.
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_normal_mar_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = TRUE, fixed_gamma = FALSE,
missing_data = "mar"))
2PL LSIRM with normal likelihood and missing completely at random data.
Description
lsirm2pl_normal_mcar is used to fit 2PL LSIRM for continuous variable in incomplete data assumed to be missing completely at random. lsirm2pl_normal_mcar factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_normal_mcar(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025 |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_normal_mcar
models 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)
Under the assumption of missing completely at random, the model ignores the missing element in doing inference. For the details of missing completely at random assumption and data augmentation, see References.
Value
lsirm2pl_normal_mcar
returns an object of list containing the following components:
data |
A data frame or matrix containing the variables used in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
Posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
gamma |
Posterior samples of the gamma parameter. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons.
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_normal_mcar(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = FALSE,
missing_data = "mcar"))
2PL LSIRM with normal likelihood and model selection approach for missing completely at random data.
Description
lsirm2pl_normal_mcar_ss is used to fit 2PL LSIRM with model selection approach based on spike-and-slab priors for continuous variable in incomplete data assumed to be missing completely at random. lsirm2pl_normal_mcar_ss factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space, while ignoring the missing element under the assumption of missing completely at random. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_normal_mcar_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_xi_a = 0.001,
pr_xi_b = 0.001,
missing.val = 99,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; the mean of spike prior for log gamma. Default is -3. |
pr_spike_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_slab_mean |
Numeric; the mean of spike prior for log gamma. Default is 0.5. |
pr_slab_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is is 1. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_xi_a |
Numeric; the first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; the second shape parameter of beta prior for latent variable xi. Default is 1. |
missing.val |
Numeric; a number to replace missing values. Default is 99. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_normal_mcar_ss
models 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)
Under the assumption of missing completely at random, the model ignores the missing element in doing inference. For the details of missing completely at random assumption and data augmentation, see References. lsirm2pl_normal_mcar_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm2pl_normal_mcar_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
missing.val |
A number to replace missing values. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
gamma |
Posterior samples of the gamma parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
pi |
Posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Little, R. J., & Rubin, D. B. (2019). Statistical analysis with missing data (Vol. 793). John Wiley & Sons. Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: Frequentist and Bayesian strategies. The Annals of Statistics, 33(2), 730-773.
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
# generate example missing indicator matrix
missing_mat <- matrix(rbinom(500, size = 1, prob = 0.2),ncol=10,nrow=50)
# make missing value with missing indicator matrix
data[missing_mat==1] <- 99
lsirm_result <- lsirm2pl_normal_mcar_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = TRUE, fixed_gamma = FALSE,
missing_data = "mcar"))
2PL LSIRM with normal likelihood
Description
lsirm2pl_normal_o is used to fit 2PL LSIRM for continuous variable. lsirm2pl_normal_o factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_normal_o(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 0.025,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025 |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_a_eps |
Numeric; the shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; the scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_normal_o
models 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)
Value
lsirm2pl_normal_o
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables used in the model. |
bic |
A numeric value representing the Bayesian Information Criterion (BIC). |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
Posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
gamma |
Posterior samples of the gamma parameter. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
sigma_estimate |
Posterior estimates of the standard deviation. |
sigma |
Posterior samples of the standard deviation. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
lsirm_result <- lsirm2pl_normal_o(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = FALSE))
2PL LSIRM with normal likelihood and model selection approach.
Description
lsirm2pl_normal_ss is used to fit 2PL LSIRM for continuous variable with model selection approach. lsirm2pl_normal_ss factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_normal_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_eps = 0.001,
pr_b_eps = 0.001,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_xi_a = 0.001,
pr_xi_b = 0.001,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; mean of spike prior for log gamma default value is -3. |
pr_spike_sd |
Numeric; standard deviation of spike prior for log gamma default value is 1. |
pr_slab_mean |
Numeric; mean of spike prior for log gamma default value is 0.5. |
pr_slab_sd |
Numeric; standard deviation of spike prior for log gamma default value is 1. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_eps |
Numeric; shape parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_b_eps |
Numeric; scale parameter of inverse gamma prior for variance of data likelihood. Default is 0.001. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_xi_a |
Numeric; first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; second shape parameter of beta prior for latent variable xi. Default is 1. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_normal_ss
models 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)
. lsrm2pl_noraml_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm2pl_normal_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables in the model. |
bic |
Numeric value with the corresponding BIC. |
mcmc_inf |
number of mcmc iteration, burn-in periods, and thinning intervals. |
map_inf |
value of log maximum a posterior and iteration number which have log maximum a posterior. |
beta_estimate |
posterior estimation of beta. |
theta_estimate |
posterior estimation of theta. |
sigma_theta_estimate |
posterior estimation of standard deviation of theta. |
sigma_estimate |
posterior estimation of standard deviation. |
gamma_estimate |
posterior estimation of gamma. |
z_estimate |
posterior estimation of z. |
w_estimate |
posterior estimation of w. |
pi_estimate |
posterior estimation of phi. inclusion probability of gamma. if estimation of phi is less than 0.5, choose Rasch model with gamma = 0, otherwise latent space model with gamma > 0. |
beta |
posterior samples of beta. |
theta |
posterior samples of theta. |
theta_sd |
posterior samples of standard deviation of theta. |
sigma |
posterior samples of standard deviation. |
gamma |
posterior samples of gamma. |
z |
posterior samples of z. The output is 3-dimensional matrix with last axis represent the dimension of latent space. |
w |
posterior samples of w. The output is 3-dimensional matrix with last axis represent the dimension of latent space. |
pi |
posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
accept_beta |
accept ratio of beta. |
accept_theta |
accept ratio of theta. |
accept_w |
accept ratio of w. |
accept_z |
accept ratio of z. |
accept_gamma |
accept ratio of gamma. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: frequentist and Bayesian strategies. The Annals of Statistics, 33(2), 730-773.
Examples
# generate example (continuous) item response matrix
data <- matrix(rnorm(500, mean = 0, sd = 1),ncol=10,nrow=50)
lsirm_result <- lsirm2pl_normal_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = TRUE, fixed_gamma = FALSE))
2PL LSIRM.
Description
lsirm2pl_o is used to fit 2PL LSIRM. lsirm2pl_o factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_o(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 0.025,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_gamma = 0.5,
pr_sd_gamma = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the gamma proposal density. Default is 0.025. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_mean_gamma |
Numeric; mean of log normal prior for gamma. Default is 0.5. |
pr_sd_gamma |
Numeric; standard deviation of log normal prior for gamma. Default is 1.0. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_o
models 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||
Value
lsirm2pl_o
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables used in the model. |
bic |
A numeric value representing the Bayesian Information Criterion (BIC). |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
Posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
gamma |
Posterior samples of the gamma parameter. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
lsirm_result <- lsirm2pl_o(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = FALSE, fixed_gamma = FALSE))
2PL LSIRM with model selection approach.
Description
lsirm2pl_ss is used to fit 2PL LSIRM with model selection approach based on spike-and-slab priors. lsirm2pl_ss factorizes item response matrix into column-wise item effect, row-wise respondent effect and further embeds interaction effect in a latent space. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect. The resulting latent space provides an interaction map that represents interactions between respondents and items.
Usage
lsirm2pl_ss(
data,
ndim = 2,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
jump_gamma = 1,
jump_z = 0.5,
jump_w = 0.5,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_spike_mean = -3,
pr_spike_sd = 1,
pr_slab_mean = 0.5,
pr_slab_sd = 1,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001,
pr_xi_a = 1,
pr_xi_b = 1,
verbose = FALSE
)
Arguments
data |
Matrix; a binary or continuous item response matrix for analysis. Each row represents a respondent, and each column contains responses to the corresponding item. |
ndim |
Integer; the dimension of the latent space. Default is 2. |
niter |
Integer; the total number of MCMC iterations to run. Default is 15000. |
nburn |
Integer; the number of initial MCMC iterations to discard as burn-in. Default is 2500. |
nthin |
Integer; the number of MCMC iterations to thin. Default is 5. |
nprint |
Integer; the interval at which MCMC samples are displayed during execution. Default is 500. |
jump_beta |
Numeric; the jumping rule for the beta proposal density. Default is 0.4. |
jump_theta |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_alpha |
Numeric; the jumping rule for the alpha proposal density. Default is 1.0. |
jump_gamma |
Numeric; the jumping rule for the theta proposal density. Default is 1.0. |
jump_z |
Numeric; the jumping rule for the z proposal density. Default is 0.5. |
jump_w |
Numeric; the jumping rule for the w proposal density. Default is 0.5. |
pr_mean_beta |
Numeric; the mean of the normal prior for beta. Default is 0. |
pr_sd_beta |
Numeric; the standard deviation of the normal prior for beta. Default is 1.0. |
pr_mean_theta |
Numeric; the mean of the normal prior for theta. Default is 0. |
pr_spike_mean |
Numeric; the mean of spike prior for log gamma. Default is -3. |
pr_spike_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is 1. |
pr_slab_mean |
Numeric; the mean of spike prior for log gamma. Default is 0.5. |
pr_slab_sd |
Numeric; the standard deviation of spike prior for log gamma. Default is is 1. |
pr_mean_alpha |
Numeric; the mean of the log normal prior for alpha. Default is 0.5. |
pr_sd_alpha |
Numeric; the standard deviation of the log normal prior for alpha. Default is 1.0. |
pr_a_theta |
Numeric; the shape parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_b_theta |
Numeric; the scale parameter of the inverse gamma prior for the variance of theta. Default is 0.001. |
pr_xi_a |
Numeric; the first shape parameter of beta prior for latent variable xi. Default is 1. |
pr_xi_b |
Numeric; the second shape parameter of beta prior for latent variable xi. Default is 1. |
verbose |
Logical; If TRUE, MCMC samples are printed for each |
Details
lsirm2pl_ss
models 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,z_j,w_i))=\theta_j*\alpha_i+\beta_i-\gamma||z_j-w_i||
lsirm2pl_ss
model include model selection approach based on spike-and-slab priors for log gamma. For detail of spike-and-slab priors, see References.
Value
lsirm2pl_ss
returns an object of list containing the following components:
data |
Data frame or matrix containing the variables used in the model. |
bic |
A numeric value representing the Bayesian Information Criterion (BIC). |
mcmc_inf |
Details about the number of MCMC iterations, burn-in periods, and thinning intervals. |
map_inf |
The log maximum a posteriori (MAP) value and the iteration number at which this MAP value occurs. |
beta_estimate |
Posterior estimates of the beta parameter. |
theta_estimate |
Posterior estimates of the theta parameter. |
sigma_theta_estimate |
Posterior estimates of the standard deviation of theta. |
gamma_estimate |
Posterior estimates of gamma parameter. |
z_estimate |
Posterior estimates of the z parameter. |
w_estimate |
Posterior estimates of the w parameter. |
beta |
Posterior samples of the beta parameter. |
theta |
Posterior samples of the theta parameter. |
theta_sd |
Posterior samples of the standard deviation of theta. |
gamma |
Posterior samples of the gamma parameter. |
z |
Posterior samples of the z parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
w |
Posterior samples of the w parameter, represented as a 3-dimensional matrix where the last axis denotes the dimension of the latent space. |
accept_beta |
Acceptance ratio for the beta parameter. |
accept_theta |
Acceptance ratio for the theta parameter. |
accept_z |
Acceptance ratio for the z parameter. |
accept_w |
Acceptance ratio for the w parameter. |
accept_gamma |
Acceptance ratio for the gamma parameter. |
pi_estimate |
Posterior estimation of phi. inclusion probability of gamma. if estimation of phi is less than 0.5, choose Rasch model with gamma = 0, otherwise latent space model with gamma > 0. |
pi |
Posterior samples of phi which is indicator of spike and slab prior. If phi is 1, log gamma follows the slab prior, otherwise follows the spike prior. |
alpha_estimate |
Posterior estimates of the alpha parameter. |
alpha |
Posterior estimates of the alpha parameter. |
accept_alpha |
Acceptance ratio for the alpha parameter. |
References
Ishwaran, H., & Rao, J. S. (2005). Spike and slab variable selection: Frequentist and Bayesian strategies. The Annals of Statistics, 33(2), 730-773.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
lsirm_result <- lsirm2pl_ss(data)
# The code following can achieve the same result.
lsirm_result <- lsirm(data ~ lsirm2pl(spikenslab = TRUE, fixed_gamma = FALSE))
1PL Rasch model.
Description
onepl is used to fit 1PL Rasch model.
Usage
onepl(
data,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_a_theta = 0.001,
pr_b_theta = 0.001
)
Arguments
data |
Matrix; binary item response matrix to be analyzed. Each row is assumed to be respondent and its column values are assumed to be response to the corresponding item. |
niter |
Numeric; number of iterations to run MCMC sampling. default value is 15000. |
nburn |
Numeric; number of initial, pre-thinning, MCMC iterations to discard. default value is 2500. |
nthin |
Numeric;number of thinning, MCMC iterations to discard. default value is 5. |
nprint |
Numeric; MCMC samples is displayed during execution of MCMC chain for each |
jump_beta |
Numeric; jumping rule of the proposal density for beta. default value is 0.4. |
jump_theta |
Numeric; jumping rule of the proposal density for theta. default value is 1.0. |
pr_mean_beta |
Numeric; mean of normal prior for beta. default value is 0. |
pr_sd_beta |
Numeric; standard deviation of normal prior for beta. default value is 1.0. |
pr_mean_theta |
Numeric; mean of normal prior for theta. default value is 0. |
pr_a_theta |
Numeric; shape parameter of inverse gamma prior for variance of theta. default value is 0.001. |
pr_b_theta |
Numeric; scale parameter of inverse gamma prior for variance of theta. default value is 0.001. |
Details
onepl
models the probability of correct response by respondent j
to item i
with item effect \beta_i
, respondent effect \theta_j
:
logit(P(Y_{j,i} = 1|\theta_j,\beta_i))=\theta_j+\beta_i
Value
onepl
returns an object of list containing the following components:
beta_estimate |
posterior estimation of beta. |
theta_estimate |
posterior estimation of theta. |
sigma_theta_estimate |
posterior estimation of standard deviation of theta. |
beta |
posterior samples of beta. |
theta |
posterior samples of theta. |
theta_sd |
posterior samples of standard deviation of theta. |
accept_beta |
accept ratio of beta. |
accept_theta |
accept ratio of theta. |
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
result <- onepl(data)
Plotting the interaction map or summarizing the parameter estimate of fitted LSIRM with box plot.
Description
plot is used to plot the interaction map of fitted LSIRM or summarizing the parameter estimate of fitted LSIRM with box plot.
Usage
plot(
object,
...,
option = "interaction",
rotation = FALSE,
cluster = NA,
which.clust = "item",
interact = FALSE,
chain.idx = 1
)
Arguments
object |
Object of class |
... |
Additional arguments for the corresponding function. |
option |
Character; If value is "interaction", draw the interaction map that represents interactions between respondents and items. If value is "beta", draw the boxplot for the posterior samples of beta. If value is "theta", draw the distribution of the theta estimates per total test score for the |
rotation |
Logical; If TRUE the latent positions are visualized after oblique (oblimin) rotation. |
cluster |
Character; If value is "neyman" the cluster result are visualized by Point Process Cluster Analysis. If value is "spectral", spectral clustering method applied. Default is NA. |
which.clust |
Character; Choose which values to clustering. "resp" is the option for respondent and "item" is the option for items. Default is "item". |
interact |
Logical; If TRUE, draw the interaction map interactively. |
chain.idx |
Numeric; Index of MCMC chain. Default is 1. |
Value
plot
returns the interaction map or boxplot for parameter estimate.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5), ncol=10, nrow=50)
lsirm_result <- lsirm(data ~ lsirm1pl())
plot(lsirm_result)
# use oblique rotation
plot(lsirm_result, rotation = TRUE)
# interaction map interactively
plot(lsirm_result, interact = TRUE)
# clustering the respondents or items
plot(lsirm_result, cluster = TRUE)
Print the summary the result of LSIRM
Description
print.summary.lsirm is used to print summary the result of LSIRM.
Usage
## S3 method for class 'summary.lsirm'
print(x, ...)
Arguments
x |
List; summary of LSIRM with |
... |
Additional arguments. |
Value
print.summary.lsirm
return a summary of LSIRM.
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
lsirm_result <- lsirm(data ~ lsirm1pl())
summary(lsirm_result)
Summary the result of LSIRM
Description
summary is used to summary the result of LSIRM.
Usage
## S3 method for class 'lsirm'
summary(object, chain.idx = 1, estimate = "mean", CI = 0.95, ...)
Arguments
object |
Object of class |
chain.idx |
Numeric; Index of MCMC chain. Default is 1. |
estimate |
Character; Specifies the type of posterior estimate to provide for beta parameters. Options are |
CI |
Numeric; The significance level for the highest posterior density interval (HPD) for the beta parameters. Default is 0.95. |
... |
Additional arguments. |
Value
summary.lsirm
contains following elements. A print method is available.
call |
R call used to fit the model. |
coef |
Covariate coefficients posterior means. |
mcmc.opt |
The number of mcmc iteration, burn-in periods, and thinning intervals. |
map.inf |
Value of log maximum a posterior and iteration number which have log maximum a posterior. |
BIC |
Numeric value with the corresponding Bayesian information criterion (BIC). |
method |
Which model is fitted. |
missing |
The assumed missing type. One of NA, "mar" and "mcar". |
dtype |
Type of input data (Binary or Continuous). |
ss |
Whether a model selection approach using the spike-slab prior is applied. |
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
# 1PL LSIRM object
lsirm_result <- lsirm(data ~ lsirm1pl())
summary(lsirm_result)
2PL Rasch model.
Description
twopl is used to fit 2PL Rasch model. Unlike 1PL model, 2PL model assumes the item effect can vary according to respondent, allowing additional parameter multiplied with respondent effect.
Usage
twopl(
data,
niter = 15000,
nburn = 2500,
nthin = 5,
nprint = 500,
jump_beta = 0.4,
jump_theta = 1,
jump_alpha = 1,
pr_mean_beta = 0,
pr_sd_beta = 1,
pr_mean_theta = 0,
pr_mean_alpha = 0.5,
pr_sd_alpha = 1,
pr_a_theta = 0.001,
pr_b_theta = 0.001
)
Arguments
data |
Matrix; binary item response matrix to be analyzed. Each row is assumed to be respondent and its column values are assumed to be response to the corresponding item. |
niter |
Numeric; number of iterations to run MCMC sampling. default value is 15000. |
nburn |
Numeric; number of initial, pre-thinning, MCMC iterations to discard. default value is 2500. |
nthin |
Numeric;number of thinning, MCMC iterations to discard. default value is 5. |
nprint |
Numeric; MCMC samples is displayed during execution of MCMC chain for each |
jump_beta |
Numeric; jumping rule of the proposal density for beta. default value is 0.4. |
jump_theta |
Numeric; jumping rule of the proposal density for theta. default value is 1.0. |
jump_alpha |
Numeric; jumping rule of the proposal density for alpha default value is 1.0. |
pr_mean_beta |
Numeric; mean of normal prior for beta. default value is 0. |
pr_sd_beta |
Numeric; standard deviation of normal prior for beta. default value is 1.0. |
pr_mean_theta |
Numeric; mean of normal prior for theta. default value is 0. |
pr_mean_alpha |
Numeric; mean of normal prior for alpha. default value is 0.5. |
pr_sd_alpha |
Numeric; mean of normal prior for beta. default value is 1.0. |
pr_a_theta |
Numeric; shape parameter of inverse gamma prior for variance of theta. default value is 0.001. |
pr_b_theta |
Numeric; scale parameter of inverse gamma prior for variance of theta. default value is 0.001. |
Details
twopl
models the probability of correct response by respondent j
to item i
with item effect \beta_i
, respondent effect \theta_j
. 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,\beta_i, \alpha_i))=\theta_j * \alpha_i+\beta_i
Value
twopl
returns an object of list containing the following components:
beta_estimate |
posterior estimation of beta. |
theta_estimate |
posterior estimation of theta. |
sigma_theta_estimate |
posterior estimation of standard deviation of theta. |
alpha_estimate |
posterior estimation of alpha. |
beta |
posterior samples of beta. |
theta |
posterior samples of theta. |
theta_sd |
posterior samples of standard deviation of theta. |
alpha |
posterior samples of alpha. |
accept_beta |
accept ratio of beta. |
accept_theta |
accept ratio of theta. |
accept_alpha |
accept ratio of alpha. |
Examples
# generate example item response matrix
data <- matrix(rbinom(500, size = 1, prob = 0.5),ncol=10,nrow=50)
result <- twopl(data)