cph_it: iterated use of 'rms::cph'

View source: R/coxreg_it.R

cph_itR Documentation

iterated use of rms::cph

Description

run the same (RHS) formula for multiple outcomes and record models, effect, residuals and continuous effects

Usage

cph_it(
  data,
  surv,
  fRHS,
  cont = NULL,
  w = NULL,
  prefix = c(time = "t.", event = "ev.")
)

cph_it_display_code()

Arguments

data

a data frame

surv

outcomes, as surv objects or specification of the outcome names where the time- and event components differ only in prefix

fRHS

right hand side of formula (do not include '~')

cont

names of variables (included in fHRS) for which the actual effects are wanted (typically continuous ones, the others are recorded anyway)

w

weights

prefix

prefix consistently used for time- and event components of (what is to become) Surv objects (only needed when surv does not indicated Surv variables already)

Value

a list with components

  • "model"list of all models created, named from surv argument

  • "HR"data frame containing all model effects

  • "resid"list of cox.zph objects, named from surv argument

  • "effect"data frame of (continuous) effects

Functions

  • cph_it_display_code(): example of code to loop out results into a rnw document (requires subdirectory 'saved-figure' but this is easily modified)


renlund/datma documentation built on June 2, 2025, 5:12 a.m.