if (!require("BiocManager"))
install.packages("BiocManager")
BiocManager::install("glmSparseNet")
library(futile.logger)
library(ggplot2)
library(glmSparseNet)
# Some general options for futile.logger the debugging package
.Last.value <- flog.layout(layout.format('[~l] ~m'))
.Last.value <- loose.rock::show.message(FALSE)
# Setting ggplot2 default theme as minimal
theme_set(ggplot2::theme_minimal())
data('ovarian', package = 'survival')
## Warning in data("ovarian", package = "survival"): data set 'ovarian' not found
xdata <- ovarian[,c('age', 'resid.ds')]
ydata <- data.frame(time = ovarian$futime, status = ovarian$fustat)
res.age <- separate2GroupsCox(c(age = 1, 0), xdata, ydata)
## Call: survfit(formula = survival::Surv(time, status) ~ group, data = prognostic.index.df)
##
## n events median 0.95LCL 0.95UCL
## Low risk 13 4 NA 638 NA
## High risk 13 8 464 268 NA
A individual is attributed to low-risk group if its calculated relative risk (using Cox Proportional model) is below or equal the median risk.
The opposite for the high-risk groups, populated with individuals above the median relative-risk.
res.age.40.60 <- separate2GroupsCox(c(age = 1, 0), xdata, ydata, probs = c(.4, .6))
## Call: survfit(formula = survival::Surv(time, status) ~ group, data = prognostic.index.df)
##
## n events median 0.95LCL 0.95UCL
## Low risk 11 3 NA 563 NA
## High risk 10 7 359 156 NA
A individual is attributed to low-risk group if its calculated relative risk (using Cox Proportional model) is below the median risk.
The opposite for the high-risk groups, populated with individuals above the median relative-risk.
This is a special case where you want to use a cutoff that includes some sample on both high and low risks groups.
res.age.60.40 <- separate2GroupsCox(
chosen.btas = c(age = 1, 0),
xdata,
ydata,
probs = c(.6, .4),
stop.when.overlap = FALSE
)
## Warning in separate2GroupsCox(chosen.btas = c(age = 1, 0), xdata, ydata, : The cutoff values given to the function allow for some over samples in both groups, with:
## high risk size (15) + low risk size (16) not equal to xdata/ydata rows (31 != 26)
##
## We are continuing with execution as parameter stop.when.overlap is FALSE.
## note: This adds duplicate samples to ydata and xdata xdata
## Kaplan-Meier results
## Call: survfit(formula = survival::Surv(time, status) ~ group, data = prognostic.index.df)
##
## n events median 0.95LCL 0.95UCL
## Low risk 16 5 NA 638 NA
## High risk 15 9 475 353 NA
A individual is attributed to low-risk group if its calculated relative risk (using Cox Proportional model) is below the median risk.
The opposite for the high-risk groups, populated with individuals above the median relative-risk.