contal: Apply contal o quigley method

View source: R/contal.R

contalR Documentation

Apply contal o quigley method

Description

Apply contal o quigley method

Usage

contal(time = NULL, status = NULL, marker = NULL)

Arguments

time

time variable

status

status variable

marker

marker variable

Examples


## Klein Moeschberg example pag 274
data(kidtran, package = "KMsurv")
kidtran <- within(kidtran, {
    gender <- factor(gender, levels = c(1,2), labels = c('male', 'female'))
    race <- factor(race, levels = c(1,2), labels = c('white', 'black'))
})
k_spl <- split(kidtran, f = list(kidtran$race, kidtran$gender))
k_spl <- k_spl[c(2,1,4,3)]
expanded <- lapply(k_spl, function(x){
    contal(time = x$time,
           status = x$delta,
           marker = x$age)
})
expanded[1] 

## expanded_survmisc <- lapply(k_spl, function(x){
##     df = data.frame(time = x$time,
##                     status = x$delta,
##                     marker = x$ag)
##     cox <- survival::coxph(Surv(time = time, event = status) ~ marker,
##                            data = df)
##     survMisc::cutp(cox)
## })

compact <- do.call(rbind, lapply(expanded, function(x) x$optimal))
compact


lbraglia/lbsurv documentation built on June 19, 2022, 11:13 p.m.