Description Usage Arguments Details Value References Examples
Get the key of the new item to administer and an update of the theta estimate, based on given answer set.
1 2 3 4 5 | shadowcat(answers, estimate, variance, model, alpha, beta, start_items,
stop_test, estimator, information_summary, prior_form = NULL,
prior_parameters = NULL, guessing = NULL, eta = NULL,
constraints_and_characts = NULL, lower_bound = NULL, upper_bound = NULL,
safe_eap = FALSE, eap_estimation_procedure = "riemannsum")
|
answers |
Named list of previous answers and new answer, with names being the item keys. Should be initialized with |
estimate |
Vector with current estimate of latent trait theta. Length should be equal to the number of dimensions. |
variance |
Current covariance matrix of the estimate, as vector. |
model |
One of |
alpha |
Matrix of alpha parameters, one column per dimension, one row per item. Row names should contain the item keys. Note that so called within-dimensional models still use an alpha matrix, they simply have only one non-zero loading per item. |
beta |
Matrix of beta parameters, one column per item step, one row per item. Row names should contain the item keys.
Note that |
start_items |
List indicating the items that should be shown to the respondent before the theta estimate will be updated
for the first time. One of
|
stop_test |
List indicating rules for when to terminate the test. Should be a list of the form
|
estimator |
Type of estimator to be used, one of |
information_summary |
How to summarize Fisher information, used for item selection. One of
|
prior_form |
String indicating the form of the prior; one of |
prior_parameters |
List containing mu and Sigma of the normal prior: |
guessing |
Matrix with one column of guessing parameters per item. Row names should contain the item keys. Optionally used in 3PLM model, ignored for all others. |
eta |
Matrix of location parameters, optionally used in GPCM model, ignored for all others. Row names should contain the item keys. If eta is defined, the beta matrix will be derived from this eta matrix by computing the cumulative sums of the rows of eta; see Glas and Dagohoy (2006). |
constraints_and_characts |
List with constraints and characteristics for Shadow Testing; |
lower_bound |
Vector with lower bounds for theta per dimension. Estimated theta values smaller than the lower bound values are truncated to the lower bound values. Can only be defined when estimator is maximum likelihood. Setting bounds with maximum likelihood estimation is equivalent to using maximum aposteriori estimation with a uniform prior. |
upper_bound |
Vector with upper bounds for theta per dimension. Estimated theta values larger than the upper bound values are truncated to the upper bound values. Can only be defined when estimator is maximum likelihood. Setting bounds with maximum likelihood estimation is equivalent to using maximum aposteriori estimation with a uniform prior. |
safe_eap |
Only relevant if estimator is expected aposteriori.
Set to |
eap_estimation_procedure |
String indicating the estimation procedure if estimator is expected aposteriori and prior form is normal. One of |
Maximum Likelihood and Maximum A-Posteriori estimates are computed using minimization algorithms
as performed by nlm
and constrOptim
. Expected A-Posteriori estimates require the
repeated evaluation of Q nested integrals, where Q is the dimensionality of the test.
This is performed with an adaptive Riemannsum or multidimensional Gauss-Hermite quadrature, the latter
handled by package MultiGHQuad
, see the documentation there for further details.
Note that the number of grid points used increases strongly with the dimensionality of the test. Use of Expected A-Posteriori
estimates with a 3+ dimensional test may not be a good idea. Note that WML estimation is not included. There is no satisfying solution to multidimensional
Weighted Maximum Likelihood Estimation. Current WML estimators as used in other sources do not account for the covariance between dimensions.
The argument constraints_and_characts
should be NULL
(no constraints on item selection) or a list of characteristics and constraints (Shadow Testing; Van der Linden, 2000).
The list should consist of two elements, named characteristics
and constraints
.
characteristics
should be specified as a data frame of characteristics. Each row indicates the characteristics of
one item. Each column indicates how all items score on a certain characteristic. Characteristics may be categorical or numeric.
constraints
should be specified as a list of constraints, each constraint is a list with three named values:
name
The column name of the characteristic this constraint applies to. For categorical characteristics the level should be specified as name/value
,
where name
is the column name of the characteristic and value
is the specific level of the characteristic this constraint applies to.
op
The logical operator to be used. Valid options are "<"
, "="
, ">"
and "><"
.
target
The target value, numeric. For categorical characteristics, it indicates the number of items of the relevant characteristic that should be administered ("="
), or
minimally (">"
), maximally ("<"
), or minimally and maximally ("><"
; vector with two values required) administered. For numeric characteristics,
it indicates the minimum and/or maximum sum allowed over all administered items, e.g., maximum time allowed.
List containing:
key_new_item |
The key of the next item to be administered given the answers to previous items. Next item is the item containing the maximum information, taking constraints into account if specified (Shadow Testing). |
continue_test |
|
estimate |
Vector containing the updated theta estimate. |
variance |
Vector containing the updated covariance matrix of theta. |
answers |
Named list containing the answers to the administered items. |
Glas, C. A. W., & Dagohoy, A. V. T. (2006). A Person Fit Test For Irt Models For Polytomous Items. Psychometrika, 72(2), 159-180.
Van der Linden, W. J. (2000). Constrained adaptive testing with shadow tests. In W. J. van der Linden & C. A. W. Glas (Eds.), Computerized adaptive testing: Theory and practice (pp. 27-52). Dordrecht, the Netherlands: Kluwer Academic Publishers.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | alpha_beta <- simulate_testbank(model = "GPCM", number_items = 100,
number_dimensions = 3, number_itemsteps = 3)
model <- "GPCM"
start_items <- list(type = 'fixed', item_keys = c("item33", "item5", "item23"), n = 3)
stop_test <- list(min_n = 4, max_n = 30, target = c(.1, .1, .1))
estimator <- "maximum_aposteriori"
information_summary <- "posterior_determinant"
prior_form <- "normal"
prior_parameters <- list(mu = c(0, 0, 0), Sigma = diag(3))
# Initial call: get key of first item to adminster
call1 <- shadowcat(answers = NULL, estimate = c(0, 0, 0), variance = as.vector(diag(3) * 25),
model = model, alpha = alpha_beta$alpha, beta = alpha_beta$beta,
start_items = start_items, stop_test = stop_test,
estimator = estimator, information_summary = information_summary,
prior_form = prior_form, prior_parameters = prior_parameters)
# Second to fourth call: number of start items is set to 3, so no update in theta estimate yet
call2 <- shadowcat(answers = list(item33 = 2), estimate = call1$estimate,
variance = call1$variance, model = model, alpha = alpha_beta$alpha,
beta = alpha_beta$beta, start_items = start_items,
stop_test = stop_test, estimator = estimator,
information_summary = information_summary,
prior_form = prior_form, prior_parameters = prior_parameters)
call3 <- shadowcat(answers = list(item33 = 2, item5 = 3),
estimate = call2$estimate, variance = call2$variance,
model = model, alpha = alpha_beta$alpha, beta = alpha_beta$beta,
start_items = start_items, stop_test = stop_test,
estimator = estimator, information_summary = information_summary,
prior_form = prior_form, prior_parameters = prior_parameters)
call4 <- shadowcat(answers = list(item33 = 2, item5 = 3, item23 = 3),
estimate = call3$estimate, variance = call3$variance,
model = model, alpha = alpha_beta$alpha, beta = alpha_beta$beta,
start_items = start_items, stop_test = stop_test,
estimator = estimator, information_summary = information_summary,
prior_form = prior_form, prior_parameters = prior_parameters)
# Fifth call: first time theta estimate is updated
call5 <- shadowcat(answers = list(item33 = 2, item5 = 3, item23 = 3, item84 = 1),
estimate = call4$estimate, variance = call4$variance, model = model,
alpha = alpha_beta$alpha, beta = alpha_beta$beta, start_items = start_items,
stop_test = stop_test, estimator = estimator,
information_summary = information_summary,
prior_form = prior_form, prior_parameters = prior_parameters)
# Sixth call: use the updated estimate and variance as the current values for estimate and variance
call6 <- shadowcat(answers = list(item33 = 2, item5 = 3, item23 = 3, item84 = 1, item36 = 2),
estimate = call5$estimate, variance = call5$variance, model = model,
alpha = alpha_beta$alpha, beta = alpha_beta$beta, start_items = start_items,
stop_test = stop_test, estimator = estimator,
information_summary = information_summary,
prior_form = prior_form, prior_parameters = prior_parameters)
# With constraints (shadow testing)
characteristics <- data.frame(content = sample(c('algebra','physics','calculus'),
size = 100, replace = TRUE),
time = runif(100),
exclusive = sapply(1:100,
function (x) {
if ( x %in% sample(1:100, size = 4) ) 1 else 0
} ))
constraints <- list(list(name = 'content/algebra',
op = '><',
target = c(5, 10)), # ensure number of algebra items is between 5 and 10
list(name = 'content/physics',
op = '><',
target = c(2, 5)), # ensure number of physics items is between 2 and 5
list(name = 'time',
op = '<',
target = 20), # Ensure total tests takes no longer than 20 minutes
list(name = 'exclusive',
op = '<',
target = 2)) # Ensure number of exclusive items equals 2
constraints_and_characteristics <- list(characteristics = characteristics,
constraints = constraints)
shadowcat(answers = NULL, estimate = c(0, 0, 0), variance = as.vector(diag(3) * 25),
model = model, alpha = alpha_beta$alpha, beta = alpha_beta$beta,
start_items = start_items, stop_test = stop_test, estimator = estimator,
information_summary = information_summary, prior_form = prior_form,
prior_parameters = prior_parameters,
constraints_and_characts = constraints_and_characteristics)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.