vr_KM_est: Wrapper for Kaplan Meier analysis for an ADaM Basic Data...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/vr_KM_est.R

Description

This function is a wrapper around survival::survfit.formula to perform a Kaplan-Meier analysis, based on the expected ADaM Basic Data Structure (BDS) for Time-to-Event analysis and assuming right-censored data. The function expects that the data has been filtered on the PARAM/PARAMCD of interest. Alternatively, PARAM/PARAMCD can be used in the strata argument.
The result is an object of class survfit which can be used in downstream functions and methods that rely on the survfit class. By default:

Usage

1
vr_KM_est(data = NULL, strata = NULL, ...)

Arguments

data

The name of the ADaM Basic Data Structure (BDS) for Time-to-Event analysis eg ADTTE. Rows in which AVAL or CNSR contain NA, are removed during analysis.

strata

Character vector, representing the strata for Time-to-Event analysis eg TRT01P. When NULL, an overall analysis is performed. Default is NULL.

...

additional arguments passed on to the ellipsis of the call survival::survfit.formula(data = data, formula = Surv(AVAL, 1-CNSR) ~ strata), ...) . Use ?survival::survfit.formula and ?survival::survfitCI for more information.

Value

survfit object, extended by elements PARAM/PARAMCD, ready for downstream processing in estimation or visualization functions and methods.

Author(s)

Steven Haesendonckx

References

https://https://github.com/therneau/survival

See Also

survfit.formula survfitCI

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(survival)
library(dplyr)
library(tidyr)

## No stratification
vr_KM_est(data = adtte)

## Stratified Kaplan-Meier analysis by `TRTP`
vr_KM_est(data = adtte, strata = "TRTP")

## Stratified Kaplan-Meier analysis by `TRTP` and `SEX` 
vr_KM_est(data = adtte, strata = c("TRTP", "SEX"))

## Stratification with one level
vr_KM_est(data = adtte, strata = "PARAMCD")

## Analysis on subset of adtte
vr_KM_est(data = adtte[adtte$SEX == "F", ])

## Modify the default analysis by using the ellipsis
vr_KM_est(data = adtte, strata = NULL, type = "kaplan-meier", conf.int = F, timefix = TRUE)

visR-sandbox/visR-survival documentation built on Sept. 18, 2020, 6:21 p.m.