landmark: Cuts survival object using (subject-specific) landmark times

Description Usage Arguments Value Author(s) See Also Examples

View source: R/transform.R

Description

Converts to missing, the survival data for subjects with events of censoring before the specified landmark times.

Usage

1
landmark(s, tstart)

Arguments

s

Survival object

tstart

Vector of times at which landmarks occur

Value

An object of class Surv.

Author(s)

Toby Johnson Toby.x.Johnson@gsk.com

See Also

Surv, dynpred package

Examples

1
2
3
4
5
6
7
8
9
library(survival)
n <- 1000 # sample size
mys <- Surv2(rexp(n, 0.1), runif(n, 0, 5)) # random survival
tlm <- runif(n, 0, 1) # time of landmark
x <- ifelse(mys[ , "time"] >= tlm, rbinom(n, 3, .5), 0)
# x is uncorrelated with mys but zero for subjects with event or
# censor before tlm==tlandmark
drop1(coxph(mys~x), test = "Chisq") # biased
drop1(coxph(landmark(mys, tlm)~x), test = "Chisq") #unbiased

tobyjohnson/gtx documentation built on Aug. 30, 2019, 8:07 p.m.