% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/compare.R
\name{lr_test}
\alias{lr_test}
\title{Likelihood-ratio test of the partial credit against the rating scale model}
\usage{
lr_test(fit, maxit = 60, tol = 1e-08)
}
\arguments{
\item{fit}{A \code{"PCM"} fit from \code{\link{rasch}} with equal maximum
scores across items (the rating parameterisation requires them).}

\item{maxit, tol}{Passed to the rating-scale refit.}
}
\value{
A list of class \code{"rasch_lr"}: raw \code{chisq}, \code{df},
  \code{p} (the conventional display); adjusted \code{chisq_adj}, \code{p_adj},
  and the eigenvalues \code{lambda}; the two log-likelihoods; and the
  rating-scale refit (\code{fit_rsm}).
}
\description{
A likelihood-ratio test in the tradition of Andersen (1973): an
unrestricted (partial credit)
analysis is compared with the rating re-parameterisation of the same
model on the same data. Twice the difference in the pairwise conditional
log-likelihoods is referred to a chi-square on the difference in the
number of threshold parameters. A non-significant outcome supports
adopting the simpler rating parameterisation.
}
\details{
The likelihood here is the pairwise composite
likelihood, not a full likelihood, and twice its difference is not
chi-square distributed: each response enters every pair its item forms,
so the raw statistic is inflated. Two statistics are therefore reported.
\code{chisq} is the raw composite value with its naive \code{p}, the
conventional display. The limiting
law of the raw statistic is \eqn{\sum_j \lambda_j \chi^2_1} (Kent 1982;
Varin, Reid and Firth 2011) with \eqn{\lambda_j} the eigenvalues of
\eqn{(C'H^{-1}C)^{-1}\,C'H^{-1}JH^{-1}C} over the \eqn{r} constrained
directions \eqn{C} (the part of the partial-credit threshold space
outside the rating subspace), estimated from the same Godambe \eqn{H}
and \eqn{J} matrices that supply the sandwich standard errors; matching
the mean gives \code{chisq_adj} \eqn{= r W / \sum_j \lambda_j} on
\eqn{r} degrees of freedom. Use \code{p_adj} for inference; the naive
\code{p} is severely anticonservative and kept only for comparability
with conventional software displays.
}
\examples{
set.seed(1)
tau <- c(-0.7, 0.7)
X <- sapply(seq(-1, 1, length.out = 6), function(d) vapply(rnorm(300),
  function(b) sample(0:2, 1, prob = item_moments(b, tau + d)$P), 0L))
colnames(X) <- paste0("Q", 1:6)
lr_test(rasch(X, model = "PCM"))
}
\references{
Kent, J. T. (1982). Robust properties of likelihood ratio
  tests. Biometrika, 69, 19-27. Varin, C., Reid, N. and Firth, D. (2011).
  An overview of composite likelihood methods. Statistica Sinica, 21,
  5-42.
}
