% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/estimation.R
\name{pcml}
\alias{pcml}
\title{Estimate Rasch thresholds by pairwise conditional maximum likelihood}
\usage{
pcml(X, model = c("PCM", "RSM"), anchors = NULL, maxit = 60, tol = 1e-08)
}
\arguments{
\item{X}{Persons-by-items integer score matrix (categories from 0). Missing
values are handled by pairwise deletion, so linked booklet designs and
random missingness estimate without imputation; the item-pair graph must
be connected (some person answering items in both of any two blocks),
otherwise relative locations between blocks are unidentified and the fit
stops with an error naming the blocks -- unless \code{anchors} fix an
item in every block, the disjoint-form equating case.}

\item{model}{\code{"PCM"} or \code{"RSM"}.}

\item{anchors}{Optional anchor table for equating: a data frame with
columns \code{item} (name or column index), \code{k}, and \code{tau}
(the fixed value). A numeric \code{k} fixes that single threshold
(individual anchoring); \code{k = NA} fixes the item's mean location at
\code{tau} while its thresholds remain free (average anchoring). The
remaining parameters are estimated on the anchored scale and no
recentring is applied. PCM only.}

\item{maxit, tol}{Newton-Raphson iteration cap and convergence tolerance.}
}
\value{
A list with the threshold table \code{thr} (columns \code{id},
  \code{item}, \code{k}, \code{tau}, \code{se}, \code{anchored}, and
  \code{weak} -- \code{TRUE} for a threshold adjacent to a category with
  fewer than 3 responses, whose estimate can run toward a boundary while
  the ridged covariance understates the error; its \code{se} is reported
  as \code{NA} and a note names the item and category), the
  threshold covariance matrix \code{cov_tau}, the pairwise conditional
  log-likelihood, the iteration count, a convergence flag, \code{notes},
  and the max-score vector \code{m}.
}
\description{
Maximises the pairwise conditional likelihood, in which the person
parameter cancels within every item pair, by Newton-Raphson (Andrich and
Luo 2003; Zwinderman 1995). The partial credit model
estimates every threshold freely; the rating scale model constrains
\code{tau_ik = delta_i + kappa_k} through the design matrix.
}
\examples{
set.seed(1)
d <- seq(-1.5, 1.5, length.out = 6)
X <- matrix(rbinom(400 * 6, 1, plogis(outer(rnorm(400), d, "-"))), 400, 6)
colnames(X) <- paste0("I", 1:6)
pcml(X)$thr
# anchor two items at fixed values (equating)
pcml(X, anchors = data.frame(item = c("I1", "I6"), k = 1, tau = c(-1.5, 1.5)))$thr
}
