% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lzstar_mixed.R
\name{lzstar_mixed}
\alias{lzstar_mixed}
\title{Compute lz and lzstar person-fit statistics for mixed-format tests}
\usage{
lzstar_mixed(
  scores,
  theta,
  vtheta,
  a,
  c,
  b,
  extreme_handling = c("na", "cap", "none"),
  theta_cap = 4
)
}
\arguments{
\item{scores}{Matrix of item scores (n_persons x n_items).}

\item{theta}{Vector of ability estimates, length must equal nrow(scores).}

\item{vtheta}{Vector of estimated variances Var(theta_hat), length must equal nrow(scores).}

\item{a}{Vector of discrimination parameters, length must equal ncol(scores).}

\item{c}{Vector of lower asymptote (guessing) parameters, length must equal ncol(scores).}

\item{b}{Matrix of thresholds, with nrow(b) = ncol(scores) and NA padding for shorter items.}

\item{extreme_handling}{Policy for extreme raw scores (all-0 or perfect):
"na" returns NA for that person, "cap" truncates theta to +/- theta_cap, "none" does nothing.}

\item{theta_cap}{Cap used when extreme_handling = "cap".}
}
\value{
A matrix with columns "lz" and "lzstar".
}
\description{
Compute lz and lzstar person-fit statistics for mixed-format tests
}
\details{
The function implements the mixed-format person-fit statistic using 3PL for dichotomous
items and GPCM for polytomous items. The calculation is kept unchanged: dichotomous item
contributions are accumulated with pr3PL, polytomous item contributions are accumulated
with prGPCM_stable and d1prGPCM, and lz and lzstar are computed from
the same denominators used in the implementation.
}
\examples{
scores <- matrix(c(
  1, 0, 2,
  0, 1, 1,
  1, 1, 3
), nrow = 3, byrow = TRUE)
theta  <- c(-0.5, 0.2, 1.1)
vtheta <- c(0.12, 0.10, 0.15)
a      <- c(1.1, 0.9, 1.3)
cpar   <- c(0.15, 0.10, 0.00)
b <- matrix(c(
  0.0,  NA,
 -0.2,  NA,
 -1.0,  0.3
), nrow = 3, byrow = TRUE)
lzstar_mixed(scores, theta, vtheta, a, cpar, b)

scores2 <- matrix(c(
  0, 1,
  1, 0
), nrow = 2, byrow = TRUE)
theta2  <- c(-1, 1)
vtheta2 <- c(0.08, 0.08)
a2      <- c(1.0, 1.2)
c2      <- c(0.05, 0.10)
b2 <- matrix(c(
  0.0, NA,
  0.3, NA
), nrow = 2, byrow = TRUE)
lzstar_mixed(scores2, theta2, vtheta2, a2, c2, b2)

}
\references{
Sinharay, S. (2026). Refining the asymptotically correct standardization of person-fit
statistics for mixed-format tests. \emph{British Journal of Mathematical and Statistical
Psychology}, \bold{00}, 1--24.

Sinharay, S. (2016). Asymptotically correct standardization of person-fit statistics beyond
dichotomous items. \emph{Psychometrika}, \bold{81}(4), 992--1013.
}
