The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
library(OneSampleLogRankTest)
Log-rank test is a popular hypothesis test used to compared survival distribution between two groups. When there are no control or comparator group or obtaining such group is difficult, it is suitable to compare survival outcomes to a demographically- matched reference population. In this package we present existing methods to conduct such test named one sample log rank test.
Approximate one sample log rank test based on Chi-squared distribution can be applied to larger sample sizes (above 20 samples). oneSampleLogRankTest function would output Standardized Mortality Ratio (SMR), p-value and confidence interval around SMR. Statistical test is conducted based on Finkelstein et al. (2003) paper.
data(dataSurv, package = "OneSampleLogRankTest")
data(dataPop_2018_2021_race_sex_eth, package = "OneSampleLogRankTest")
## approximate one sample log rank test
oneSampleLogRankTest(dataSurv, dataPop_2018_2021_race_sex_eth,
type = "approximate")
#> $p.value
#> [1] 0.1216871
#>
#> $estimate
#> std_mort_ratio_est lwr upr
#> 1 1.531173 0.8302562 2.823816
Mortality rate in the sample of interest is 1.531 times that in the general population and it is not significantly different from the general population.
Kaplan-Meier curve is a useful visualization tool to compared the survival outcome in the population of interest and the general population. Type of test would be one of the argument in this function and the p-value would be displayed accordingly.
plotKM(dataSurv, dataPop_2018_2021_race_sex_eth, type = "approximate")
For a small sample set and exact test would be applied as described in F D Liddel (1984) paper.
data(dataSurv_small, package = "OneSampleLogRankTest")
## exact test version of one sample log rank test for small sample size
oneSampleLogRankTest(dataSurv_small, dataPop_2018_2021_race_sex_eth)
#> $p.value
#> [1] 0.00729568
#>
#> $estimate
#> std_mort_ratio_est lwr upr
#> 1 3.283826 1.417723 6.470446
In the small data set, mortality ratio is significantly higher compared to the general population and it is about 3.3 fold higher.
plotKM(dataSurv_small, dataPop_2018_2021_race_sex_eth, type = "exact")
A simulated data set with 500 patients were generated based on sex, race, age, and survival time distribution based on real clinical trial data. Female to male ratio was 30:70 and there were four different race groups: Asian, Black, Other / More than one race and White.
This simulated clinical trial data will be compared against CDC Wonder database data to assess if the survival outcomes are comparable or significantly different between this population and general population.
data(simulated_clinical_data)
oneSampleLogRankTest(simulated_clinical_data, dataPop_2018_2021_race_sex_eth,
type = "approximate")
#> $p.value
#> [1] 0
#>
#> $estimate
#> std_mort_ratio_est lwr upr
#> 1 9.420534 8.014948 11.07262
In the simulated clinical trial, the mortality ratio is around 9.42 times that of general population and it is highly significant.
plotKM(simulated_clinical_data, dataPop_2018_2021_race_sex_eth, type = "approximate")
Kaplan-Meir curve clearly shows that the simulated patient population is different from the general population.
sessionInfo()
#> R version 4.1.0 (2021-05-18)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Red Hat Enterprise Linux
#>
#> Matrix products: default
#> BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.3.so
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
#> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] OneSampleLogRankTest_0.9.2
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.7 lattice_0.20-44 tidyr_1.1.4
#> [4] zoo_1.8-9 digest_0.6.28 utf8_1.2.2
#> [7] R6_2.5.1 survminer_0.4.9 cellranger_1.1.0
#> [10] backports_1.2.1 evaluate_0.14 highr_0.9
#> [13] ggplot2_3.4.2 pillar_1.9.0 rlang_1.1.1
#> [16] curl_4.3.2 readxl_1.3.1 rstudioapi_0.13
#> [19] data.table_1.14.2 car_3.0-11 jquerylib_0.1.4
#> [22] Matrix_1.3-3 rmarkdown_2.11 labeling_0.4.2
#> [25] splines_4.1.0 stringr_1.4.0 foreign_0.8-81
#> [28] munsell_0.5.0 broom_1.0.5 compiler_4.1.0
#> [31] xfun_0.26 pkgconfig_2.0.3 htmltools_0.5.2
#> [34] tidyselect_1.2.0 tibble_3.2.1 gridExtra_2.3
#> [37] km.ci_0.5-2 rio_0.5.27 fansi_0.5.0
#> [40] withr_2.5.0 dplyr_1.1.2 ggpubr_0.4.0
#> [43] grid_4.1.0 jsonlite_1.7.2 xtable_1.8-4
#> [46] gtable_0.3.0 lifecycle_1.0.3 magrittr_2.0.3.9000
#> [49] KMsurv_0.1-5 scales_1.2.1 zip_2.2.0
#> [52] cli_3.6.1 stringi_1.7.4 carData_3.0-4
#> [55] farver_2.1.0 ggsignif_0.6.3 bslib_0.3.0
#> [58] ellipsis_0.3.2 survMisc_0.5.5 generics_0.1.3
#> [61] vctrs_0.6.3 openxlsx_4.2.4 tools_4.1.0
#> [64] forcats_0.5.1 glue_1.6.2 purrr_1.0.2
#> [67] hms_1.1.1 abind_1.4-5 fastmap_1.1.0
#> [70] survival_3.5-5 yaml_2.2.1 colorspace_2.0-2
#> [73] rstatix_0.7.0 knitr_1.36 haven_2.4.3
#> [76] sass_0.4.0
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.