knitr::opts_chunk$set(echo = TRUE)
if (!require("BiocManager")) { install.packages("BiocManager") } BiocManager::install("glmSparseNet")
library(futile.logger) library(ggplot2) library(glmSparseNet) library(survival) # Some general options for futile.logger the debugging package flog.layout(layout.format("[~l] ~m")) options("glmSparseNet.show_message" = FALSE) # Setting ggplot2 default theme as minimal theme_set(ggplot2::theme_minimal())
data("cancer", package = "survival") xdata <- survival::ovarian[, c("age", "resid.ds")] ydata <- data.frame( time = survival::ovarian$futime, status = survival::ovarian$fustat )
(group cutoff is median calculated relative risk)
resAge <- separate2GroupsCox(c(age = 1, 0), xdata, ydata)
resAge$km
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.
resAge$plot
resAge4060 <- separate2GroupsCox(c(age = 1, 0), xdata, ydata, probs = c(.4, .6) )
resAge4060$km
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.
resAge4060$plot
This is a special case where you want to use a cutoff that includes some sample on both high and low risks groups.
resAge6040 <- separate2GroupsCox( chosenBetas = c(age = 1, 0), xdata, ydata, probs = c(.6, .4), stopWhenOverlap = FALSE )
cat("Kaplan-Meier results", "\n") resAge6040$km
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.
resAge6040$plot
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.