% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/blockfit_solve.R
\name{.bf_gee_deviance}
\alias{.bf_gee_deviance}
\title{Compute Whitened Deviance for GEE Convergence Monitoring}
\usage{
.bf_gee_deviance(y_vec, mu_vec, W_vec, ord, obs_wt, VhInv, fam, ...)
}
\arguments{
\item{y_vec}{Numeric vector of observed responses.}

\item{mu_vec}{Numeric vector of fitted means.}

\item{W_vec}{Numeric vector of damped Newton-Raphson weights at current iterate.}

\item{ord}{Integer vector of observation indices (passed to
custom deviance residual functions).}

\item{obs_wt}{Numeric vector of observation weights.}

\item{VhInv}{\eqn{\mathbf{V}^{-1/2}} matrix (permuted to
partition ordering).}

\item{fam}{GLM family object.}

\item{...}{Additional arguments forwarded to
\code{fam$custom_dev.resids}.}
}
\value{
Scalar; the mean whitened deviance.
}
\description{
Evaluates deviance in the whitened (decorrelated) space when the
family supplies \code{fam$custom_dev.resids}.  In that case the raw
deviance residuals are divided by \eqn{\sqrt{W}} and then
pre-multiplied by \eqn{\mathbf{V}^{-1/2}} before squaring and
averaging.  If only \code{fam$dev.resids} is available, the function
falls back to the usual mean deviance (and otherwise mean squared
error).  Used in the GEE refinement loop (Case c) of
\code{\link{blockfit_solve}}.
}
\keyword{internal}
