% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/likelihood-multiphase.R
\name{.hzr_gradient_multiphase}
\alias{.hzr_gradient_multiphase}
\title{Gradient of the multiphase log-likelihood}
\usage{
.hzr_gradient_multiphase(
  theta,
  time,
  status,
  time_lower = NULL,
  time_upper = NULL,
  x = NULL,
  weights = NULL,
  phases,
  covariate_counts,
  x_list,
  ...
)
}
\arguments{
\item{theta}{Full parameter vector (internal scale).}

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

\item{status}{Numeric event indicator: 1 = event, 0 = right-censored,
-1 = left-censored, 2 = interval-censored.}

\item{time_lower}{Optional lower bounds for interval censoring.}

\item{time_upper}{Optional upper bounds for left/interval censoring.}

\item{x}{Design matrix (unused directly; kept for interface compatibility).}

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

\item{covariate_counts}{Named integer vector of per-phase covariate counts.}

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

\item{...}{Ignored.}
}
\value{
Numeric vector of length \code{length(theta)} -- the gradient.
Returns a zero vector if any component is non-finite (guards optimizer).
}
\description{
Computes the score vector \eqn{d\ell / d\theta} using analytic chain-rule
formulas for \code{log_mu} and \code{beta} parameters, and central-difference
derivatives (via \code{.hzr_phase_derivatives()}) for shape parameters
(\code{log_t_half}, \code{nu}, \code{m}).
}
\keyword{internal}
