tof_find_log_rank_threshold: Compute the log-rank test p-value for the difference between...

View source: R/modeling_helpers.R

tof_find_log_rank_thresholdR Documentation

Compute the log-rank test p-value for the difference between the two survival curves obtained by splitting a dataset into a "low" and "high" risk group using all possible relative-risk thresholds.

Description

Compute the log-rank test p-value for the difference between the two survival curves obtained by splitting a dataset into a "low" and "high" risk group using all possible relative-risk thresholds.

Usage

tof_find_log_rank_threshold(input_data, relative_risk_col, time_col, event_col)

Arguments

input_data

A tbl_df or data.frame in which each observation is a row.

relative_risk_col

An unquote column name indicating which column contains the relative-risk estimates for each observation.

time_col

An unquoted column name indicating which column contains the true time-to-event information for each observation.

event_col

An unquoted column name indicating which column contains the outcome (event or censorship). Must be a binary column - all values should be either 0 or 1 (with 1 indicating the adverse event and 0 indicating censorship) or FALSE and TRUE (with TRUE indicating the adverse event and FALSE indicating censorship).

Value

A tibble with 3 columns: "candidate_thresholds" (the relative-risk threshold used for the log-rank test), "log_rank_p_val" (the p-values of the log-rank tests) and "is_best" (a logical value indicating which candidate threshold gave the optimal, i.e. smallest, p-value).


keyes-timothy/tidytof documentation built on Aug. 28, 2024, 8:37 a.m.