Summarize and Plot Posterior Predictive Item-Restscore Associations
Source:R/post_helpers.R
item_restscore_post.RdPostprocesses the output of item_restscore_statistic
to produce a summary table and a slab plot comparing observed
item-restscore gamma associations to the posterior predictive
distribution.
Arguments
- item_restscore
A list as returned by
item_restscore_statistic, containing at minimum:- result
A data frame with columns including
itemand summary statistics (first 5 columns are used).- draws
A data frame with columns
item,gamma(observed gamma per draw), andgamma_rep(replicated gamma per draw).
Details
The item-restscore gamma association measures the strength of the relationship between each item's responses and the rest score (total score excluding that item). Under good fit, the observed gamma should fall within the posterior predictive distribution.
The plot displays:
- Grey slab
The posterior predictive distribution of replicated gamma values, shaded by 84\ interval levels.
- Orange diamonds
The observed gamma values per draw, plotted as points on top of the slab.
Items where the observed gamma (orange) falls consistently outside the replicated distribution (grey) indicate poor fit in terms of item discrimination.
Examples
if (FALSE) { # \dontrun{
library(brms)
library(ggplot2)
# Assuming fit_pcm is a fitted brmsfit object
irs <- item_restscore_statistic(fit_pcm)
result <- item_restscore_post(irs)
result$summary
result$plot
} # }