% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/export.R
\name{save_item_plots}
\alias{save_item_plots}
\title{Save a plot for every item}
\usage{
save_item_plots(
  fit,
  what = c("icc", "ccc", "tpc", "cfreq"),
  file,
  items = NULL,
  n_groups = fit$n_groups,
  grid = seq(-5, 5, 0.05),
  observed = TRUE,
  width = 8,
  height = 5.5,
  dpi = 300
)
}
\arguments{
\item{fit}{A fitted object from \code{\link{rasch}}.}

\item{what}{Which plot: \code{"icc"}, \code{"ccc"}, \code{"tpc"}, or
\code{"cfreq"}.}

\item{file}{Output path ending in \code{.pdf} (one page per item) or
\code{.zip} (one PNG per item).}

\item{items}{Item names or indices; all items by default.}

\item{n_groups}{Class intervals for observed overlays.}

\item{grid}{Logit grid for the curves.}

\item{observed}{Overlay observed proportions on the category and
threshold probability curves.}

\item{width, height, dpi}{Device size in inches and PNG resolution.}
}
\value{
Invisibly, the output path.
}
\description{
Writes one plot per item -- the item characteristic curve, category
probability curves, threshold probability curves, or category
frequencies -- to a single multi-page PDF or a ZIP archive of PNGs,
chosen by the extension of \code{file}.
}
\examples{
set.seed(1)
d <- seq(-2, 2, length.out = 6)
X <- matrix(rbinom(400 * 6, 1, plogis(outer(rnorm(400), d, "-"))), 400, 6)
colnames(X) <- paste0("I", 1:6)
f <- rasch(X)
save_item_plots(f, "icc", file.path(tempdir(), "icc_all.pdf"))
}
