| q3_post | R Documentation |
Postprocesses the output of q3_statistic to produce
summary tables of posterior predictive Q3 statistics and a combined
slab + interval plot comparing observed Q3 residual correlations
to the posterior predictive distribution for each item pair.
q3_post(
q3_draws,
ci = 0.84,
n_pairs = NULL,
sort_by = c("q3_diff", "q3_obs", "ppp")
)
q3_draws |
A data frame (or tibble) as returned by
|
ci |
Numeric in |
n_pairs |
Integer. Maximum number of item pairs to display
in the plot, selected by largest absolute |
sort_by |
Character. How to order item pairs on the y-axis.
|
Two complementary summary tables are provided:
summaryReports posterior mean observed and replicated Q3 values alongside the posterior predictive p-value (ppp). The ppp is the proportion of draws where the observed Q3 exceeds the replicated Q3. Under good fit (no local dependence), the ppp should be near 0.5. A ppp close to 1 indicates the observed correlation is systematically higher than expected (local dependence); a ppp close to 0 indicates it is systematically lower (local repulsion, e.g., speed-accuracy tradeoffs).
hdiReports the probability that the observed Q3 falls above (local dependence) or below (local repulsion) the HDI of the replicated distribution. This provides a more distributional assessment than the ppp alone.
The plot uses two layers from the ggdist package:
stat_slabDisplays the posterior predictive (replicated) Q3 distribution as a filled density slab per item pair, shaded by credible interval level.
stat_slabintervalDisplays the observed Q3 distribution per item pair as a semi-transparent slab with point and interval summaries.
A list with three elements:
A tibble with one row per
item pair containing: item_pair, item_1,
item_2, q3_obs (posterior mean observed Q3),
q3_rep (posterior mean replicated Q3),
q3_diff (posterior mean difference), and q3_ppp
(posterior predictive p-value: proportion of draws where the
observed Q3 exceeds the replicated Q3).
A tibble with one row per
item pair containing: item_pair, item_1,
item_2, ld (local dependence probability:
proportion of draws where observed Q3 exceeds upper HDI
bound of replicated distribution), and lr (local
repulsion probability: proportion of draws where observed
Q3 falls below lower HDI bound).
A ggplot object showing
the posterior predictive distribution of replicated Q3
(grey filled slab) overlaid with the observed Q3
distribution (coloured slab + interval), with a dashed
reference line at 0.
q3_statistic,
infit_post,
item_restscore_post.
## Not run:
library(brms)
library(ggplot2)
# Assuming fit_pcm is a fitted brmsfit object
q3_draws <- q3_statistic(fit_pcm, ndraws_use = 500)
result <- q3_post(q3_draws)
result$summary
result$hdi
result$plot
# Show only top 10 pairs by Q3 difference
result_top <- q3_post(q3_draws, n_pairs = 10)
result_top$plot
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.