View source: R/item_parameters.R
| RMitemParameters | R Documentation |
Estimates item difficulty (dichotomous) or item-category threshold (polytomous) parameters and returns them in long or wide format, with optional standard errors and Wald confidence intervals. Item parameters are estimated by conditional maximum likelihood (CML, via psychotools) by default, with marginal maximum likelihood (MML, via mirt) available for sparse data where CML can be unstable.
RMitemParameters(
data,
estimator = c("CML", "MML"),
format = c("long", "wide"),
se = TRUE,
ci_level = 0.95,
center = TRUE,
output = c("kable", "dataframe", "file"),
filename = NULL
)
data |
A data.frame or matrix of item responses. Items must be
scored starting at 0 (non-negative integers). Missing values ( |
estimator |
Character. |
format |
Character. |
se |
Logical. If |
ci_level |
Numeric in (0, 1). Confidence level for the Wald
interval ( |
center |
Logical. If |
output |
Character. |
filename |
Character. Path to the CSV file to write when
|
Items are detected as dichotomous (maximum score 1) or polytomous
(maximum score > 1), and the Rasch or Partial Credit model is chosen
accordingly. Thresholds are reported as Andrich thresholds (the
person locations at which adjacent response categories are equally
probable) on the logit difficulty scale, matching RMtargeting().
Standard errors. For the CML path, threshold SEs are the
square roots of the diagonal of the threshold-parameter covariance from
psychotools::threshpar(vcov = TRUE). For the MML path, SEs come from
the mirt parameter covariance, propagated by the delta method
through the linear threshold map.
Confidence intervals are Wald intervals and are symmetric on the
logit scale.
For output = "dataframe", a data.frame. In long format the
columns are item, threshold (integer; 1 for dichotomous items),
location, and – when se = TRUE – se, ci_lower, ci_upper.
In wide format the columns are item, the threshold locations
(t1, t2, ... or location for dichotomous items), and a mean
location; when se = TRUE, matching se_t1, se_t2, ... columns
are appended. For output = "kable", the same content as a
knitr_kable object.
Andrich, D. (1978). A rating formulation for ordered response categories. Psychometrika, 43(4), 561-573. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF02293814")}
Mair, P., & Hatzinger, R. (2007). Extended Rasch modeling: The eRm package for the application of IRT models in R. Journal of Statistical Software, 20(9), 1-20. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v020.i09")}
RMpersonParameters(), RMscoreSE(), RMtargeting()
set.seed(1)
poly <- as.data.frame(
matrix(sample(0:2, 250 * 5, replace = TRUE), nrow = 250, ncol = 5)
)
colnames(poly) <- paste0("Item", 1:5)
# Default: long-format kable with SE and 95% CI
RMitemParameters(poly)
# Wide format, point estimates only
RMitemParameters(poly, format = "wide", se = FALSE, output = "dataframe")
# Dichotomous data
dich <- as.data.frame(
matrix(sample(0:1, 250 * 6, replace = TRUE), nrow = 250, ncol = 6)
)
colnames(dich) <- paste0("Item", 1:6)
RMitemParameters(dich, output = "dataframe")
# Write the parameter table to a CSV (also returned invisibly)
RMitemParameters(poly, output = "file",
filename = tempfile(fileext = ".csv"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.