% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Reml_Cox_frailty.R
\name{Reml_Cox_frailty}
\alias{Reml_Cox_frailty}
\title{Cox Model with Random Frailty (REML Estimation)}
\usage{
Reml_Cox_frailty(data, max_iter = 300, tol = 1e-06, threshold = 1e-05)
}
\arguments{
\item{data}{A data frame containing:
\itemize{
\item \code{times}: observed survival or censoring times,
\item \code{status}: event indicator (1 = event, 0 = censored),
\item \code{clusters}: cluster identifiers (e.g., center, group),
\item covariates from column 4 onward.
}}

\item{max_iter}{Maximum number of Newton-Raphson iterations (default = 300).}

\item{tol}{Tolerance for convergence (default = 1e-6).}

\item{threshold}{Lower bound for the frailty variance parameter \eqn{\theta}. If the estimated value falls below this threshold, frailty is considered negligible (default = 1e-5).}
}
\value{
A list with the following elements:
\describe{
\item{beta}{Estimated fixed effects (regression coefficients).}
\item{u}{Estimated random effects (frailties) for each cluster.}
\item{theta}{Estimated variance of the random effects.}
\item{p_value}{P-value for testing the null hypothesis \eqn{H_0: \theta = 0} (no frailty).}
}
}
\description{
Estimates the regression coefficients, random effects, and frailty variance \eqn{\theta} in a Cox proportional hazards model with shared frailty using Restricted Maximum Likelihood (REML).
}
\details{
The function uses a REML-based Newton-Raphson approach to estimate the parameters.
A penalized likelihood including a log-likelihood contribution for the frailty variance \eqn{\theta} is maximized.

The hypothesis test of \eqn{H_0: \theta = 0} is based on a Wald-type statistic. A high p-value (e.g. > 0.05) may indicate that the random effects (frailties) are negligible.
}
\seealso{
\code{\link{Ml_Cox}}, \code{\link{logLikelihood_1}}, \code{\link{logLikelihood_2}}
}
