coxphSeries: Run a series of Cox regression models

View source: R/coxphSeries.R

coxphSeriesR Documentation

Run a series of Cox regression models

Description

Run a series of Cox regression analyses for a list of predictor variables and summarize the results in a table. The Cox models can be adjusted for a fixed set of covariates

This function runs on coxph from the survival package.

Usage

coxphSeries(formula, data, vars, ...)

Arguments

formula

The fixed part of the regression formula. For univariate analyses this is simply Surv(time,status)~1 where Surv(time,status) is the outcome variable. When the aim is to control the effect of vars in each element of the series by a fixed set of variables it is Surv(time,status)~x1+x2 where again Surv(time,status) is the outcome and x1 and x2 are confounders.

data

A data.frame in which the formula gets evaluated.

vars

A list of variable names, the changing part of the regression formula.

...

passed to publish.coxph

Value

matrix with results

Author(s)

Thomas Alexander Gerds

Examples

library(survival)
data(pbc)
## collect hazard ratios from three univariate Cox regression analyses
pbc$edema <- factor(pbc$edema,levels=c("0","0.5","1"),labels=c("0","0.5","1"))
uni.hr <- coxphSeries(Surv(time,status==2)~1,vars=c("edema","bili","protime"),data=pbc)
uni.hr

## control the logistic regression analyses for age and gender
## but collect only information on the variables in `vars'.
controlled.hr <- coxphSeries(Surv(time,status==2)~age+sex,vars=c("edema","bili","protime"),data=pbc)
controlled.hr


Publish documentation built on Jan. 18, 2023, 1:08 a.m.