% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/subgroup_survival.R
\name{subgroup_survival}
\alias{subgroup_survival}
\title{Subgroup Survival Analysis Using Cox Proportional Hazards Models}
\usage{
subgroup_survival(
  pdata,
  time_name = "time",
  status_name = "status",
  variables,
  object
)
}
\arguments{
\item{pdata}{Data frame containing variables, follow-up time, and outcome.}

\item{time_name}{Character. Column name of follow-up time. Default is `"time"`.}

\item{status_name}{Character. Column name of event status (1/0).
Default is `"status"`.}

\item{variables}{Character vector. Subgrouping variables (each processed
independently).}

\item{object}{Character. Variable of interest used in Cox model. If it has
levels "High" and "Low", recode "High" to 0 and "Low" to 1 before calling.}
}
\value{
Data frame summarizing subgroup Cox results (HR, CI, p-value).
}
\description{
Extracts hazard ratios (HR) and 95% confidence intervals from Cox
proportional hazards models across specified subgroups.
}
\examples{
set.seed(123)
test_pdata <- data.frame(
  time = runif(100, 1, 100),
  status = sample(c(0, 1), 100, replace = TRUE),
  subgroup = sample(c("A", "B"), 100, replace = TRUE),
  score = rnorm(100)
)
res <- subgroup_survival(
  pdata = test_pdata,
  time_name = "time",
  status_name = "status",
  variables = "subgroup",
  object = "score"
)
print(res)
}
\author{
Dongqiang Zeng
}
