analyse_multivariate {survivalAnalysis} | R Documentation |
Multivariate analysis (Cox Regression)
Description
Performs Cox regression on right-censored data using a multiple covariates.
Usage
analyse_multivariate(
data,
time_status,
covariates,
strata = NULL,
covariate_name_dict = NULL,
covariate_label_dict = NULL,
reference_level_dict = NULL,
sort_frame_by = vars(HR)
)
analyze_multivariate(
data,
time_status,
covariates,
strata = NULL,
covariate_name_dict = NULL,
covariate_label_dict = NULL,
reference_level_dict = NULL,
sort_frame_by = vars(HR)
)
Arguments
data |
A data frame containing the time/status information and, if used, the covariate. |
time_status |
A vector of length 2 giving the time and status fields.
It is recommended to use vars() and symbolic column names or code that is tidily-evaluated on |
covariates |
The covariates.
Pass symbolic columns names or code that is tidily-evaluated on |
strata |
Strata (optional). Same format as covariates. For each strata level (if multiple fields, unique combinations of levels) a separate baseline hazard is fit. |
covariate_name_dict |
A dictionary (named list or vector) of old->new covariate names |
covariate_label_dict |
A dictionary (named list or vector) of old->new covariate value level labels |
reference_level_dict |
For categorical variables, the Cox regression uses pseudo variables for each level
relative to a reference category, resulting in n-1 variables for n levels of a categorical covariate.
Hazard ratios will be relative to the reference level, which is defined as having hazard ratio 1.0.
Per default, the reference level is the first factor level.
You can specify a different level by passing a named vector: factor name -> value of reference level.
Note that this is independent of covariate_label_dict, i.e. specify the factor level as it is in |
sort_frame_by |
A vars() list of one or more symbolic column names.
The result contains a data frame of the cox regression results ( |
Details
This method builds upon the survival
package and returns a comprehensive result object
for survival analysis containing the coxph results.
A format
/print
method is provided that prints the essential statistics.
Value
An object of class "SurvivalAnalysisResult" and "SurvivalAnalysisMultivariateResult".
You can use this result as a black box for further functions in this package,
format
or
print
it,
retrieve information as a data frame via multivariate_as_data_frame
or
access individual pieces via pluck_multivariate_analysis
See Also
Examples
library(magrittr)
library(dplyr)
survival::colon %>%
analyse_multivariate(vars(time, status),
vars(rx, sex, age, obstruct, perfor, nodes, differ, extent)) %>%
print()