View source: R/separate_2_groups_cox.R
separate2GroupsCox | R Documentation |
Draws multiple kaplan meyer survival curves (or just 1) and calculates logrank test
separate2GroupsCox(
chosenBetas,
xdata,
ydata,
probs = c(0.5, 0.5),
noPlot = FALSE,
plotTitle = "SurvivalCurves",
xlim = NULL,
ylim = NULL,
expandYZero = FALSE,
legendOutside = FALSE,
stopWhenOverlap = TRUE,
...,
chosen.btas = deprecated(),
no.plot = deprecated(),
plot.title = deprecated(),
expand.yzero = deprecated(),
legend.outside = deprecated(),
stop.when.overlap = deprecated()
)
chosenBetas |
list of testing coefficients to calculate prognostic
indexes, for example |
xdata |
n x m matrix with n observations and m variables. |
ydata |
Survival object. |
probs |
How to separate high and low risk patients |
noPlot |
Only calculate p-value and do not generate survival curve plot. |
plotTitle |
Name of file if. |
xlim |
Optional argument to limit the x-axis view. |
ylim |
Optional argument to limit the y-axis view. |
expandYZero |
expand to y = 0. |
legendOutside |
If TRUE legend will be outside plot, otherwise inside. |
stopWhenOverlap |
when probs vector allows for overlapping of samples in both groups, then stop. |
... |
additional parameters to survminer::ggsurvplot |
chosen.btas |
|
no.plot |
|
plot.title |
|
expand.yzero |
|
legend.outside |
|
stop.when.overlap |
Otherwise it will calculate with duplicate samples, i.e. simply adding them to xdata and ydata (in a different group). |
object with logrank test and kaplan-meier survival plot
A list with plot, p-value and kaplan-meier object. The plot was drawn from survminer::ggsurvplot with only the palette, data and fit arguments being defined and keeping all other defaults that can be customized as additional parameters to this function.
survminer::ggsurvplot()
xdata <- survival::ovarian[, c("age", "resid.ds")]
ydata <- data.frame(
time = survival::ovarian$futime,
status = survival::ovarian$fustat
)
separate2GroupsCox(c(age = 1, 0), xdata, ydata)
separate2GroupsCox(c(age = 1, 0.5), xdata, ydata)
separate2GroupsCox(
c(age = 1), c(1, 0, 1, 0, 1, 0),
data.frame(time = runif(6), status = rbinom(6, 1, .5))
)
separate2GroupsCox(list(
aa = c(age = 1, 0.5),
bb = c(age = 0, 1.5)
), xdata, ydata)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.