as_ped: Transform data to Piece-wise Exponential Data (PED)

Description Usage Arguments Value Examples

View source: R/as-ped.R

Description

This is the general data transformation function provided by the ped package. Two main applications must be distinguished:

  1. Transformation of standard time-to-event data.

  2. Transformation of time-to-event data with time-dependent covariates (TDC).

For the latter, the type of effect one wants to estimate is also important for the data transformation step. In any case, the data transformation is specified by a two sided formula. In case of TDCs, the right-hand-side of the formula can contain formula specials concurrent and cumulative. See the data-transformation vignette for details.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
as_ped(data, formula, ...)

## S3 method for class 'data.frame'
as_ped(data, formula, cut = NULL, max_time = NULL,
  tdc_specials = c("concurrent", "cumulative"), ...)

## S3 method for class 'nested_fdf'
as_ped(data, formula, ...)

## S3 method for class 'list'
as_ped(data, formula, tdc_specials = c("concurrent",
  "cumulative"), ...)

is.ped(x)

Arguments

data

Either an object inheriting from data frame or in case of time-dependent covariates a list of data frames, where the first data frame contains the time-to-event information and static covariates while the second (and potentially further data frames) contain information on time-dependent covariates and the times at which they have been observed.

formula

A two sided formula with a Surv object on the left-hand-side and covariate specification on the right-hand-side (RHS). The RHS can be an extended formula, which specifies how TDCs should be transformed using specials concurrent and cumulative.

...

Further arguments passed to the data.frame method and eventually to survSplit

cut

Break points, used to partition the follow up into intervals. If unspecified, all unique event times will be used.

max_time

If cut is unspecified, this will be the last possible event time. All event times after max_time will be administratively censored at max_time.

tdc_specials

A character vector. Names of potential specials in formula for concurrent and or cumulative effects.

x

any R object.

Value

A data frame class ped in piece-wise exponential data format.

Examples

1
2
3
tumor[1:3, ]
tumor[1:3, ] %>% as_ped(Surv(days, status)~ age + sex, cut = c(0, 500, 1000))
tumor[1:3, ] %>% as_ped(Surv(days, status)~ age + sex)

adibender/ped documentation built on Dec. 16, 2019, 12:33 a.m.