singlearm | R Documentation |
Performs survival analysis for a single cohort of patients without group comparisons. Use this when you want to analyze overall survival characteristics of your entire study population - for example, to determine median survival time or 1/3/5-year survival rates for all patients collectively. This differs from regular survival analysis which compares survival between groups.
singlearm(
data,
elapsedtime,
tint = FALSE,
dxdate,
fudate,
outcome,
outcomeLevel,
dod,
dooc,
awd,
awod,
analysistype = "overall",
cutp = "12, 36, 60",
timetypedata = "ymd",
timetypeoutput = "months",
uselandmark = FALSE,
landmark = 3,
sc = FALSE,
kmunicate = FALSE,
ce = FALSE,
ch = FALSE,
endplot = 60,
ybegin_plot = 0,
yend_plot = 1,
byplot = 12,
multievent = FALSE,
ci95 = FALSE,
risktable = FALSE,
censored = FALSE,
medianline = "none"
)
data |
The data as a data frame. |
elapsedtime |
The time-to-event or follow-up duration for each patient. Should be numeric and continuous, measured in consistent units (e.g., months or years). Can be calculated automatically from dates if using the date options below. |
tint |
Enable this option if you want to calculate survival time from dates in your data. This is useful when you have separate columns for diagnosis date and follow-up date and want to calculate the time elapsed between them. |
dxdate |
The date of diagnosis or study entry for each patient. Should be in a consistent date format (e.g., YYYY-MM-DD). |
fudate |
The date of last follow-up or event for each patient. Should be in a consistent date format (e.g., YYYY-MM-DD). |
outcome |
The outcome or event of interest for each patient. Should be a factor or numeric variable indicating whether the patient experienced the event (e.g., death) or censoring (e.g., end of follow-up). |
outcomeLevel |
Select the level of the outcome variable that represents the event of interest. For example, if the outcome variable is "death_status" with levels "Alive" and "Dead", select "Dead" as the event level. |
dod |
Select the level of the outcome variable that represents death due to disease. This is useful for competing risk analysis when there are multiple event types. |
dooc |
Select the level of the outcome variable that represents death due to other causes. This is useful for competing risk analysis when there are multiple event types. |
awd |
Select the level of the outcome variable that represents being alive with disease. This is useful for competing risk analysis when there are multiple event types. |
awod |
Select the level of the outcome variable that represents being alive without disease. This is useful for competing risk analysis when there are multiple event types. |
analysistype |
Select the type of survival analysis to perform. "Overall" analyzes the survival of all patients regardless of event type. "Cause Specific" analyzes the survival for a specific event type (e.g., death due to disease). "Competing Risk" analyzes the survival for multiple event types simultaneously. |
cutp |
Specify the time points at which to calculate survival probabilities. Enter a comma-separated list of time points in consistent units (e.g., months or years). For example, "12, 36, 60" calculates survival probabilities at 1, 3, and 5 years. |
timetypedata |
select the time type in data (e.g., YYYY-MM-DD) |
timetypeoutput |
select the time type in output (default is months) |
uselandmark |
Enables landmark analysis, which addresses immortal time bias by analyzing survival only for patients who survive to a specified timepoint (the landmark). Use this when you want to eliminate the effect of early deaths or when comparing treatments that can only be given to patients who survive long enough to receive them. |
landmark |
Enables landmark analysis, which addresses immortal time bias by analyzing survival only for patients who survive to a specified timepoint (the landmark). Use this when you want to eliminate the effect of early deaths or when comparing treatments that can only be given to patients who survive long enough to receive them. |
sc |
Enable this option to generate a Kaplan-Meier survival plot with confidence intervals. This plot shows the estimated survival probability over time and is useful for visualizing survival trends in your data. |
kmunicate |
Enable this option to generate a publication-ready survival plot in the style of KMunicate. This plot shows the estimated survival probability over time with confidence intervals and is suitable for publication or presentation. |
ce |
Enable this option to calculate and plot the cumulative number of events over time. This plot shows the total number of events (e.g., deaths) that have occurred at each time point and is useful for visualizing event rates in your data. |
ch |
Enable this option to calculate and plot the cumulative hazard function over time. This plot shows the cumulative risk of experiencing the event (e.g., death) at each time point and is useful for visualizing the risk of the event over time. |
endplot |
The maximum time point to include in the survival plots. This is the end time for the survival curves and cumulative event/hazard plots. Enter a positive integer representing the time in consistent units (e.g., months or years). |
ybegin_plot |
The minimum value for the y-axis in the survival plots. Enter a number between 0 and 1 to set the lower limit of the y-axis. |
yend_plot |
The maximum value for the y-axis in the survival plots. Enter a number between 0 and 1 to set the upper limit of the y-axis. |
byplot |
The interval for plotting survival probabilities. Enter a positive integer representing the time interval in consistent units (e.g., months or years). |
multievent |
Enable this option to perform survival analysis for datasets with multiple event levels. This is useful for competing risk analysis when there are multiple event types (e.g., death due to disease, death due to other causes). |
ci95 |
Enable this option to display 95\ survival plots. These intervals show the range of uncertainty around the estimated survival probabilities and are useful for assessing the precision of the estimates. |
risktable |
Enable this option to display a table of risk estimates at each time point. This table shows the estimated survival probability, cumulative event rate, and cumulative hazard at each time point and is useful for summarizing the survival characteristics of your data. |
censored |
Enable this option to display censored observations on the survival plots. Censored observations are patients who have not experienced the event of interest by the end of follow-up and are indicated by vertical ticks on the survival curves. |
medianline |
If true, displays a line indicating the median survival time on the survival plot. |
A results object containing:
results$todo | a html | ||||
results$medianSummary | a preformatted | ||||
results$medianTable | a table | ||||
results$survTableSummary | a preformatted | ||||
results$survTable | a table | ||||
results$plot | an image | ||||
results$plot2 | an image | ||||
results$plot3 | an image | ||||
results$plot6 | an image | ||||
results$calculatedtime | an output | ||||
results$outcomeredefined | an output | ||||
Tables can be converted to data frames with asDF
or as.data.frame
. For example:
results$medianTable$asDF
as.data.frame(results$medianTable)
# Example analyzing overall survival for a patient cohort:
# singlearm(
# data = patient_data,
# time = "months_survival",
# outcome = "death_status",
# outcome_level = "Dead"
# )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.