sim_cph: Simulate time-to-event Cox Proportional Hazards exponential...

Description Usage Arguments Value Examples

View source: R/sim_cph.R

Description

Simulates survival data from a Cox Proportional Hazards model with the exponential distribution (Bender 2005).

Usage

1
sim_cph(N, formula, X = NULL, beta, tfun = texp(lambda = 0.5))

Arguments

N

desired sample size of simulated data

formula

formula of covariates provided as vectors

X

model matrix of covariates

beta

vector of coefficients

tfun

a time function from Bender 2005 with distributional parameters as input. Current options: texp(lambda), tweibull(lambda, nu), tgompertz(lambda, alpha)

Value

data.frame

Examples

1
2
3
x1 <- rnorm(10)
x2 <- rnorm(10)
sim_cph(N = 10, formula = ~ x1 + x2, beta = c(1, 0.5),  tfun = texp(lambda = 0.5))

a-chernofsky/project2 documentation built on Oct. 21, 2021, 10:23 p.m.