Assess the proportional hazards assumptions with plots and statistical tests.
Source:R/quick_PH.R
quick_PH.Rd
Assess the proportional hazards assumptions with plots and statistical tests.
Usage
quick_PH(
data,
time,
event,
strata,
plot.theme = theme_easysurv(),
risk.table.theme = theme_easysurv(grid = FALSE),
strata_labels = NULL,
subtitle = NULL,
font.family = "Roboto Condensed",
...
)
Arguments
- data
A tibble or dataframe containing the survival data with columns
time
,event
andstrata
.- time
The name of the time variable in data
- event
The name of the event variable in data
- strata
The name of the strata variable in data
- plot.theme
ggplot2 theme for cloglog and schoenfeld plots. Default is theme_easysurv()
- risk.table.theme
ggplot2 theme for the risk table of clogclog plot.
- strata_labels
Optional. A character vector containing the names of the stratas (default is NULL). Provide in a consistent order with
levels(as.factor(data$strata))
.- subtitle
Optional. A subtitle for all plots (default is NULL). Consider using the endpoint name.
- font.family
Font for the plot. Default is Roboto Condensed.
- ...
Optional arguments for the cloglogplot (created by plot_KM)
Value
An object of class quick_PH
containing the following elements:
- cloglogplot
A log cumulative hazard plot in a
easysurv
theme- coxph_HR
A
summary.coxPH
object containing statistical test outputs, namely the Cox PH hazard ratio and confidence intervals.- coxzph_ph_test
A
summary.coxPH
object containing statistical test outputs- schoenfeld_plot
A Schoenfeld residuals plot in a
easysurv
theme
Examples
if (FALSE) {
# Load required packages
library(survival)
library(easysurv)
input_data <- survival::lung
surv_data <- tibble(
time = input_data$time,
event = input_data$status - 1,
strata = as.factor(input_data$sex)
)
PH_check <- quick_PH(
data = surv_data,
time = "time",
event = "event",
strata = "strata"
)
}