Scan for interactions between variables and output results. Both logistic and Cox proportional hazards regression models are supported. The predictor variables in the model are can be used both in linear form or in restricted cubic spline form.
interaction_scan(
data,
y,
time = NULL,
time2 = NULL,
predictors = NULL,
group_vars = NULL,
covars = NULL,
cluster = NULL,
try_rcs = TRUE,
p_adjust_method = "BH",
save_table = FALSE,
filename = NULL
)A data frame containing the results of the interaction analysis.
A data frame.
A character string of the outcome variable.
A character string of the time variable. If NULL, logistic regression is used.
Otherwise, Cox proportional hazards regression is used.
A character string of the ending time of the interval for interval censored or counting process data only.
The predictor variables to be scanned for interactions. If NULL, all variables
except y and time are taken as predictors.
The group variables to be scanned for interactions. If NULL, all variables
except y and time are taken as group variables. The group variables should be categorical. If a
numeric variable is included, it will be split by the median value.
A character vector of covariate names.
A character string of the cluster variable. If set, correct for heteroscedasticity and for
correlated responses from cluster samples using rms::robcov().
A logical value indicating whether to perform restricted cubic spline interaction analysis.
The method to use for p-value adjustment for pairwise comparison. Default is "BH".
See ?p.adjust.methods.
A logical value indicating whether to save the results as a table.
The name of the file to save the results. File will be saved in .csv format.
data(cancer, package = "survival")
interaction_scan(cancer, y = "status", time = "time", save_table = FALSE)
Run the code above in your browser using DataLab