test_ph {easysurv}R Documentation

Test Proportional Hazards Assumption

Description

Assesses the proportional hazards assumption for survival data using a Cox proportional hazards model and related tests.

Usage

test_ph(data, time, event, group, plot_theme = theme_easysurv())

Arguments

data

A data frame containing the survival data.

time

The name of the column in data containing the time-to-event information.

event

The name of the column in data indicating whether the event of interest occurred.

group

The name of the column in data defining the grouping variable.

plot_theme

The theme to be used for the plots.

Value

A list containing plots and test results related to the assessment of the proportional hazards assumption.

cloglog_plot

A plot of the log cumulative hazard function. If the lines are roughly parallel, this suggests that the proportional hazards assumption holds."

coxph_model

The coefficients from the Cox proportional hazards model. The exp(coef) column shows the hazard ratio.

survdiff

The results of the log-rank test for differences in survival curves between groups. A p-value less than 0.05 suggests that survival differences between groups are statistically significant.

coxph_test

The results of the proportional hazards assumption test. A p-value less than 0.05 suggests that the proportional hazards assumption may be violated.

schoenfeld_plot

A plot of the Schoenfeld residuals. A flat smoothed line close to zero supports the proportional hazards assumption. A non-flat smoothed line with a trend suggests the proportional hazards assumption is violated.

Examples

ph_results <- test_ph(
  data = easysurv::easy_bc,
  time = "recyrs",
  event = "censrec",
  group = "group"
)

ph_results

[Package easysurv version 2.0.1 Index]