% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/post_helpers.R
\name{item_restscore_post}
\alias{item_restscore_post}
\title{Summarize and Plot Posterior Predictive Item-Restscore Associations}
\usage{
item_restscore_post(item_restscore)
}
\arguments{
\item{item_restscore}{A list as returned by
\code{\link{item_restscore_statistic}}, containing at minimum:
\describe{
\item{result}{A data frame with columns including \code{item}
and summary statistics (first 5 columns are used).}
\item{draws}{A data frame with columns \code{item},
\code{gamma} (observed gamma per draw), and
\code{gamma_rep} (replicated gamma per draw).}
}}
}
\value{
A list with two elements:
\describe{
\item{summary}{A \code{\link[tibble]{tibble}} with the first 5
columns of the result table, rounded to 3 decimal places and
sorted by item.}
\item{plot}{A \code{\link[ggplot2]{ggplot}} object showing
the posterior predictive distribution of replicated gamma
(grey filled slab) with the observed gamma values overlaid
as orange diamond points.}
}
}
\description{
Postprocesses the output of \code{\link{item_restscore_statistic}}
to produce a summary table and a slab plot comparing observed
item-restscore gamma associations to the posterior predictive
distribution.
}
\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:
\describe{
\item{Grey slab}{The posterior predictive distribution of
replicated gamma values, shaded by 84\\% and 95\\% credible
interval levels.}
\item{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{
\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
}

}
\seealso{
\code{\link{item_restscore_statistic}},
\code{\link{infit_post}}.
}
