This function compares survival curves as modeled with do_kpm()
.
It outputs a contingency table and a Chisq measure of difference.
Arguments
- kds
data set of a survival model such as
do_kpm()
- cond
character of experimental condition variable in the data
- test_type
numeric (0 or 1) parameter that controls the type of test (0 means rho = 0; log-rank, 1 means rho = 1; Peto & Peto Wilcox)
Value
Returns survival test results as called from survival::survdiff()
.
Examples
kpm_est <- do_kpm(add_dropout_idx(dropRdemo, 3:54))
get_survdiff(kpm_est$d, "experimental_condition", 0)
#> Call:
#> survdiff(formula = f, data = kds, rho = test_type)
#>
#> N Observed Expected (O-E)^2/E (O-E)^2/V
#> experimental_condition=11 72 72 73.7 0.0407 0.0996
#> experimental_condition=12 57 57 46.6 2.2969 5.5166
#> experimental_condition=21 56 56 59.2 0.1755 0.3878
#> experimental_condition=22 61 60 65.4 0.4450 1.0120
#>
#> Chisq= 5.7 on 3 degrees of freedom, p= 0.1
get_survdiff(kpm_est$d, "experimental_condition", 1)
#> Call:
#> survdiff(formula = f, data = kds, rho = test_type)
#>
#> N Observed Expected (O-E)^2/E (O-E)^2/V
#> experimental_condition=11 72 50.4 50.0 0.00318 0.0122
#> experimental_condition=12 57 45.2 38.0 1.35827 4.7009
#> experimental_condition=21 56 37.4 39.4 0.10730 0.3805
#> experimental_condition=22 61 37.8 43.4 0.70499 2.5778
#>
#> Chisq= 5.9 on 3 degrees of freedom, p= 0.1