Log-rank test
wrapper_log_rank_test_core_simple.Rd
Log-rank test
Usage
wrapper_log_rank_test_core_simple(
data,
tte_var,
censor_var,
covariate_var,
strata_vars = NULL,
keep_obs = TRUE,
variable_names = NULL,
caption = NULL,
sr_times = NULL,
print_nevent = TRUE,
print_mst = TRUE,
print_hr = TRUE,
print_total = FALSE,
print_pvalues = TRUE
)
wrapper_log_rank_test_core_simple_strat(
data,
tte_var,
censor_var,
covariate_var,
strata_vars = NULL,
strat1_var = NULL,
strat2_var = NULL,
variable_names = NULL,
caption = NULL,
sr_times = NULL,
print_nevent = TRUE,
print_mst = TRUE,
print_hr = TRUE,
print_total = TRUE,
print_pvalues = TRUE,
print_adjpvalues = TRUE
)
Arguments
- data
Data frame.
- tte_var
Name of the time-to-event variable. This variable must be numeric.
- censor_var
Name of the censor variable. It has to be numeric and encode 1 for event and 0 for censor.
- covariate_var
Name of covariate that defines subgroups where the survival is estimated.
- strata_vars
Vector with names of covariates that are used as strata.
- variable_names
Named vector with variable names. If not supplied, variable names are created by replacing in column names underscores with spaces.
- caption
Caption for the table with results.
- print_nevent
Logical. Whether to print numbers of events.
- print_mst
Logical. Whether to print median survival time (MST).
- print_hr
Logical. Whether to print hazard rations estimated with Cox regression.
- print_total
Logical. Whether to print total number of samples and total number of events.
- print_pvalues
Logical. Whether to print p-values.
- strat1_var
Name of the firts stratification variable.
- strat2_var
Name of the second stratification variable.
- print_adjpvalues
Logical. Whether to print adjusted p-values.
Examples
data(bdata)
data <- bdata
tte_var <- "PFS"
censor_var <- "PFS_Event"
covariate_var <- "Treatment_Arm"
x <- wrapper_log_rank_test_core_simple(data, tte_var = tte_var, censor_var = censor_var, covariate_var = covariate_var)
boutput(x)
#> Covariate Subgroup N Events MST MST 95% CI HR HR 95% CI
#> 1 Treatment Arm CTRL 252 109 (43.3%) 83.1 (78.3 - NA)
#> 2 TRT 248 105 (42.3%) 99.9 (87.5 - NA) 0.79 (0.60 - 1.03)
#> P-value
#> 1 0.0806 .
#> 2
### Fit a stratified model
strata_vars <- c("IPI", "Cell_Of_Origin")
x <- wrapper_log_rank_test_core_simple(data, tte_var = tte_var, censor_var = censor_var, covariate_var = covariate_var, strata_vars = strata_vars)
boutput(x)
#> Covariate Subgroup N Events MST MST 95% CI HR HR 95% CI
#> 1 Treatment Arm CTRL 223 95 (42.6%) 83.3 (80.3 - NA)
#> 2 TRT 222 90 (40.5%) 100.3 (88.7 - NA) 0.70 (0.52 - 0.94)
#> P-value
#> 1 0.0167 *
#> 2
data(bdata)
data <- bdata
tte_var <- "PFS"
censor_var <- "PFS_Event"
covariate_var <- "Treatment_Arm"
strat1_var = "Cell_Of_Origin"
x <- wrapper_log_rank_test_core_simple_strat(data, tte_var = tte_var, censor_var = censor_var, covariate_var = covariate_var, strat1_var = strat1_var)
boutput(x)
#> Cell Of Origin Covariate Subgroup Total N Total Events N Events
#> 1 GCB Treatment Arm CTRL 252 91 135 56 (41.5%)
#> 2 TRT 252 91 117 35 (29.9%)
#> 3 UNCLASSIFIED Treatment Arm CTRL 69 37 32 15 (46.9%)
#> 4 TRT 69 37 37 22 (59.5%)
#> 5 ABC Treatment Arm CTRL 124 57 56 24 (42.9%)
#> 6 TRT 124 57 68 33 (48.5%)
#> MST MST 95% CI HR HR 95% CI P-value Adj. P-value
#> 1 85.6 (78.3 - NA) 0.0090 ** 0.0269 *
#> 2 NA (100.3 - NA) 0.57 (0.37 - 0.87)
#> 3 83.3 (55.1 - NA) 0.6926 0.6926
#> 4 82.1 (57.4 - 92.1) 1.14 (0.59 - 2.20)
#> 5 82.6 (63.6 - NA) 0.5822 0.6926
#> 6 92.0 (71.9 - NA) 0.86 (0.51 - 1.46)