tvc: Create a time interaction variable

Description Usage Arguments Details Value See Also Examples

Description

tvc creates a time interaction variable that can be used in a coxph model (or any other model with time interactions)

Usage

1
  tvc(data, b, tvar, tfun = "linear", pow = NULL)

Arguments

data

a data frame

b

the non-time interacted variable's name

tvar

the time variable's name

tfun

function of time that btvc was multiplied by. Default is tfun = "linear". Can also be tfun = "log" (natural log) and tfun = "power". If tfun = "power" then the pow argument needs to be specified also.

pow

if tfun = "power", then use pow to specify what power to raise the time interaction to.

Details

Interacts a variable with a specified function of time. Possible functions of time include 'linear', natural 'log', and exponentiated ('power').

Value

a vector

See Also

ggtvc, coxsimtvc, survival, and coxph

Examples

1
2
3
4
5
# Load Golub & Steunenberg (2007) Data
data("GolubEUPData")

# Create natural log time interaction with the qmv variable
GolubEUPData$Lqmv <- tvc(GolubEUPData, b = "qmv", tvar = "end", tfun = "log")

christophergandrud/simtvc documentation built on May 13, 2019, 7:03 p.m.