Fit a (penalized) Cox proportional hazards model on microbiome data contained in a SummarizedExperiment object. Data transformations (e.g. pairwise log-ratios) should be handled upstream (e.g. with mia::transformAssay). This function focuses on the statistical model.

getSurvival(x, ...)

addSurvival(x, ...)

# S4 method for class 'SummarizedExperiment'
addSurvival(x, time.col, status.col, name = "survival", ...)

# S4 method for class 'SummarizedExperiment'
getSurvival(
  x,
  time.col,
  status.col,
  assay.type = "counts",
  col.var = NULL,
  ...
)

Arguments

x

A SummarizedExperiment object.

...

additional arguments.

  • penalized: Logical. If TRUE, fit penalized Cox regression using glmnet. If FALSE, fit standard Cox model using survival::coxph. (Default: TRUE)

  • lambda: Character or numeric. Penalization parameter passed to cv.glmnet. Use "lambda.1se", "lambda.min", or a numeric value. (Default: "lambda.1se")

  • alpha: Numeric scalar. Elastic net mixing parameter: 1 = Lasso, 0 = Ridge. (Default: 0.9)

  • nfolds: Integer scalar. Number of cross-validation folds for cv.glmnet. (Default: 10)

  • nvar: Integer scalar. Optional. Maximum number of variables (log-ratios) to include in the model. (Default: NULL)

  • coef.threshold: Numeric scalar. Minimum absolute value for a coefficient to be included in the final model. (Default: 0)

time.col

Character scalar. Column name in colData(x) representing time to event or follow-up time. Must be numeric.

status.col

Character scalar. Column name in colData(x) representing event occurrence. Accepts numeric (0/1) or logical (FALSE/TRUE) values.

name

Character vector. Specifies a column name for storing divergence results. (Default: c("divergence", "time_diff", "ref_samples"))

assay.type

Character scalar. Specifies which assay values are used in the dissimilarity estimation. (Default: "counts")

col.var

Character vector. Optional. Specifies covariate columns in colData(x) to adjust for in the survival model. (Default: NULL)

Value

A list with model summaries:

  • coefficients: estimated model coefficients

  • selected.features: nonzero features in penalized model

  • risk_scores: predicted risk scores

  • cindex.apparent: apparent concordance index

  • cv.cindex.mean: mean cross-validated C-index (if penalized)

  • cv.cindex.sd: SD of cross-validated C-index (if penalized)

  • fit: fitted model object (coxph or cv.glmnet)

References

Meritxell Pujolassos , Antoni Susín , M.Luz Calle (2024). Microbiome compositional data analysis for survival studies NAR Genomics and Bioinformatics, 6(2), lqae038. doi:10.1093/nargab/lqae038

See also

coda_coxnet, cv.glmnet

Examples

# data(SurvivalData)
# tse <- SurvivalData
# getSurvival(tse, time.col = "T1Dweek", status.col = "T1D", 
# col.var = c("Sex", "Antibiotics"))