View source: R/item_restscore.R
| RMitemRestscore | R Documentation |
Computes observed and model-expected item-restscore correlations using
iarm::item_restscore(), and enriches the output with the absolute
difference between observed and expected values, item average locations, and
item locations relative to the sample mean person location.
RMitemRestscore(data, output = "kable", sort, p_adj = "BH")
data |
A data.frame or matrix of item responses. Items must be scored
starting at 0 (non-negative integers). Missing values ( |
output |
Character string controlling the return value. Either
|
sort |
Optional character string. When |
p_adj |
Character string specifying the p-value adjustment method
passed to |
Item-restscore correlations using Goodman-Kruskal's gamma (Kreiner, 2011) measure the association between a person's score on a single item and their total score on the remaining items (the "restscore"). Under a correctly fitting Rasch model, observed and model-expected correlations should agree closely.
Item parameters are estimated by conditional maximum likelihood via
psychotools::pcmodel() (a dichotomous item is a 2-category PCM); the
item-restscore statistic itself comes from iarm::item_restscore() and is
conditional on the total score, so it is invariant to the estimation engine.
Per-item average locations are the means of the CML thresholds, and the
person-location reference is the mean of the Warm WLE estimates.
Relative item location is defined as the item's average location minus the sample mean person location, providing a measure of item targeting.
The iarm package must be installed (it is in Suggests, not Imports).
If output = "kable": a knitr_kable object (plain text table via
format = "pipe") with columns for item name, observed and expected
restscore correlations, the signed difference (observed minus
expected), adjusted p-value, the Flagged misfit label, and item
location relative to the sample mean person location.
If output = "dataframe": a data.frame with columns Item, Observed,
Expected, Difference, p_adjusted, Flagged, and
Relative_location. Flagged is "overfit" (observed above expected,
adj. p < .05), "underfit" (below, adj. p < .05), or "" (not flagged).
The Difference column is signed (observed minus expected):
positive values indicate that the item correlates more strongly with
the rest-score than the Rasch model predicts (over-discrimination /
overfit, often associated with local dependence), and negative
values indicate weaker-than-expected association (under-discrimination
/ underfit, often associated with multidimensionality or noise).
Kreiner, S. (2011). A Note on Item–Restscore Association in Rasch Models. Applied Psychological Measurement, 35(7), 557–561. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1177/0146621611410227")}
if (requireNamespace("iarm", quietly = TRUE)) {
# Simulate binary item response data (8 items, 200 persons)
set.seed(42)
sim_data <- as.data.frame(
matrix(sample(0:1, 200 * 8, replace = TRUE), nrow = 200, ncol = 8)
)
colnames(sim_data) <- paste0("Item", 1:8)
# Default kable output
RMitemRestscore(sim_data)
# Sorted by absolute difference
RMitemRestscore(sim_data, sort = "diff")
# Return as data.frame for further processing
df <- RMitemRestscore(sim_data, output = "dataframe")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.