Survival Analysis for Continuous Variable
Usage
survivalcont(
data,
elapsedtime,
tint = FALSE,
dxdate,
fudate,
contexpl,
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,
findcut = FALSE,
multievent = FALSE,
ci95 = FALSE,
risktable = FALSE,
censored = FALSE
)
Arguments
- 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).
- contexpl
The continuous explanatory variable to be used in the analysis.
- outcome
The outcome variable to be used in the analysis.
- outcomeLevel
The level of the outcome variable that represents the event of interest.
- dod
.
- dooc
.
- awd
.
- awod
Select the levels of the outcome variable that correspond to different event types in your data. For example, you might have separate levels for "Dead of Disease" and "Alive w Disease" in a survival analysis of cancer patients.
- analysistype
Select the type of survival analysis to perform. "Overall" survival analysis considers all events as equivalent, while "Cause Specific" analysis distinguishes between different event types. "Competing Risk" analysis accounts for competing risks that may prevent the event of interest from occurring.
- cutp
Specify the cutpoints at which to divide the continuous explanatory variable into groups for survival analysis. Separate multiple cutpoints with commas (e.g., "12, 36, 60").
- timetypedata
select the time type in data
- timetypeoutput
select the time type in output
- uselandmark
Enable this option to perform landmark survival analysis at a specified time point.
- landmark
Specify the landmark time at which to evaluate survival probabilities in landmark analysis. This option is only available if you enable the "Use Landmark Time" option.
- sc
Enable this option to create a Kaplan-Meier survival plot for the continuous explanatory variable.
- kmunicate
Enable this option to create a KMunicate-style survival plot for the continuous explanatory variable.
- ce
Enable this option to create a plot of cumulative events over time for the continuous explanatory variable.
- ch
Enable this option to create a plot of cumulative hazard over time for the continuous explanatory variable.
- endplot
Specify the end time for the survival plots. This option determines the maximum time point to include in the plots.
- ybegin_plot
Specify the starting value for the y-axis in the survival plots. This option allows you to customize the range of the y-axis.
- yend_plot
Specify the ending value for the y-axis in the survival plots. This option allows you to customize the range of the y-axis.
- byplot
Specify the time interval for the survival plots. This option determines the spacing of tick marks on the x-axis.
- findcut
Enable this option to automatically find the optimal cut-off point for the continuous explanatory variable using the maximally selected rank statistic. This option is only available if you enable the "Survival Plot" option. The optimal cut-off point will be displayed on the survival plot as a vertical dashed line.
- multievent
Enable this option if your data includes multiple event levels (e.g., different types of events or outcomes). This option is required for cause-specific and competing risk survival analyses.
- ci95
Enable this option to display 95\ the survival estimates in the plots.
- risktable
Enable this option to display a table of risk estimates for each group in the survival analysis.
- censored
Enable this option to display censored observations in the survival plots.
Value
A results object containing:
results$todo | a html | ||||
results$coxSummary | a preformatted | ||||
results$coxTable | a table | ||||
results$tCoxtext2 | a html | ||||
results$rescutTable | a table | ||||
results$plot4 | an image | ||||
results$plot5 | an image | ||||
results$medianSummary | a preformatted | ||||
results$medianTable | a table | ||||
results$survTableSummary | a preformatted | ||||
results$survTable | a table | ||||
results$plot2 | an image | ||||
results$plot3 | an image | ||||
results$plot6 | an image | ||||
results$calculatedtime | an output | ||||
results$outcomeredefined | an output | ||||
results$calculatedcutoff | an output |
Tables can be converted to data frames with asDF
or as.data.frame
. For example:
results$coxTable$asDF
as.data.frame(results$coxTable)