
Cox Proportional Hazards Model for Survival Analysis
gly_cox.Rd
Fit a Cox proportional hazards model for each variable in the expression data, and extract p-values and hazard ratios from it.
Usage
gly_cox(
exp,
time_col = "time",
event_col = "event",
p_adj_method = "BH",
add_info = TRUE,
...
)
gly_cox_(expr_mat, time, event, p_adj_method = "BH", ...)
Arguments
- exp
A
glyexp::experiment()
object containing expression matrix and sample information.- time_col
A character string specifying the column name in sample information that contains survival time. Default is "time".
- event_col
A character string specifying the column name in sample information that contains event indicator (1 for event, 0 for censoring). Default is "event".
- p_adj_method
A character string specifying the method to adjust p-values. See
p.adjust.methods
for available methods. Default is "BH". If NULL, no adjustment is performed.- add_info
A logical value. If TRUE (default), variable information from the experiment will be added to the result tibble. If FALSE, only the Cox model results are returned. Only applicable to
gly_cox()
.- ...
Additional arguments passed to
survival::coxph()
.- expr_mat
A numeric matrix with variables as rows and samples as columns.
- time
A numeric vector specifying the survival time for each sample.
- event
A numeric vector specifying the event indicator for each sample (1 for event, 0 for censoring).
Value
A list with two elements:
tidy_result
: A tibble with Cox model results containing the following columns:variable
: Variable namecoefficient
: Regression coefficient (log hazard ratio)std.error
: Standard error of the coefficientstatistic
: Wald test statisticp
: Raw p-value from Wald testhr
: Hazard ratio (exp(coefficient))p_adj
: Adjusted p-value (if p_adj_method is not NULL)
raw_result
: A list of rawcoxph
model objects.
Details
The function fits an Cox proportional hazards model for each variable by:
coxph(Surv(time, event) ~ expression_value)
P-values are adjusted by Benjamini-Hochberg method by default.