drawTttSequence: Draw treatment sequence

View source: R/drawTttSeq.r

drawTttSequenceR Documentation

Draw treatment sequence

Description

Draw treatment sequence for multiple and intermittent exposures (treatment switches) in the estimation of IPW using a survival model. Based on two vectors defining if treatment starts, is continued, is stopped or if no treatment on the time interval.

Usage

drawTttSequence(x = seqx, returnType = "init")

Arguments

x

a treatment sequence (made of 0 and 1)

returnType

define which vector to return (init of term)

Details

init takes values of 1 (treatment started), 0 (no treatment) or NA (if term is non missing) ; term takes values of 1 (treatment stopped), 0 (treatment continuation) or NA (if init is non missing)

Value

vector

Author(s)

JuG

Examples

seqx <- c(1,1,1,0,0,1,1,0,1,1)
seqx <- c(0, 1, 0, 0, 1, 1, 1, 1)
seqx <- c(0,0,0,0,0)
seqx <- c(1,1,1,1,1)
init <- drawTttSequence(x = seqx, returnType = "init")
term <- drawTttSequence(x = seqx, returnType = "term")
rbind(seqx, init, term)

jgodet/utilitR documentation built on May 16, 2024, 12:01 p.m.