% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/likelihood-multiphase.R
\name{.hzr_conserve_events}
\alias{.hzr_conserve_events}
\title{Apply the Conservation of Events adjustment to one phase's log_mu}
\usage{
.hzr_conserve_events(
  theta,
  fixmu_phase,
  fixmu_pos,
  time,
  status,
  phases,
  covariate_counts,
  x_list,
  total_events,
  weights = NULL
)
}
\arguments{
\item{theta}{Full parameter vector (internal scale).}

\item{fixmu_phase}{Character: name of the phase whose log_mu is solved.}

\item{fixmu_pos}{Integer: position of that log_mu in theta.}

\item{time}{Numeric vector of follow-up times.}

\item{status}{Numeric event indicator.}

\item{phases}{Named list of validated \code{hzr_phase} objects.}

\item{covariate_counts}{Named integer vector.}

\item{x_list}{Named list of per-phase design matrices.}

\item{total_events}{Numeric: sum of observed events (precomputed, weighted
when \code{weights} is supplied).}

\item{weights}{Optional numeric vector of row weights (length n). Defaults to
unit weights. Applied when summing per-phase cumhaz so Turner's adjustment
is computed on the same scale as \code{total_events}.}
}
\value{
Updated theta vector with fixmu phase's log_mu adjusted.
}
\description{
Given the current theta vector, analytically solve the fixmu phase's
log_mu so that total predicted events = total observed events.
}
\details{
This is called BEFORE each likelihood evaluation inside the optimizer,
matching the C HAZARD \code{CONSRV} entry point.
}
\keyword{internal}
