fit_tte_data: Fit Weibull, Log-Normal or Exponential survival curves to...

Description Usage Arguments Value Author(s) Examples

View source: R/event_prediction.R

Description

This is a function to fit Weibull and log-normal curves to patient-level Survival data using maximum likelihood estimation.
By default it fits both, then picks the best fit based on the log-likelihood (and implicitly the AIC).
Alternatively, just one shape may be fitted, by changing the 'type' argument to either "Weibull" or "Lognormal". This function is primarily used by event_prediction_data function, but also useful for general Survival function curve fitting.
One useful aspect of this is for fitting the 'inverse KM', where drop-outs are events, while events and 'time-outs' are censored. This allows for finding a suitable parameterisation for the censoring curve.
Where patient-level data is available, this function will typically perform substantially better than fit_KM, with lower variability of point estimates (and more accurate quantification of it).

Usage

1
2
3
4
5
6
7
8
fit_tte_data(
  data,
  Time = "Time",
  Event = "Event",
  censoringOne = FALSE,
  type = c("automatic", "Weibull", "Lognormal", "Exponential"),
  init = NULL
)

Arguments

data

The dataframe object containing the patient-level survival data

Time

The column name for the times. Default is "Time"

Event

The column name for the events column (i.e. the binary variable denoting events vs censorings). Default is "Event"

censoringOne

Specify whether censoring is denoted in the Event column by a one (TRUE) or zero (FALSE). Default=FALSE (censorings denoted by 0, events by 1)

type

Type of event curve to fit. Default is "Automatic", fitting both Weibull and Log-normal curves. Alternatively accepts "Weibull" or "Lognormal" to force the type.

init

Vector of starting values for parameter values; useful if survreg experiences convergence issues. Default=NULL (no values specified)

Value

Returns a 3-item list providing information needed to define a Curve object:

Author(s)

James Bell

Examples

1
2
3
4
5
recruit <- PieceR(matrix(c(rep(1,12),10,15,25,30,45,60,55,50,65,60,55,30),ncol=2),1)
example_data <- simulate_trials(active_ecurve=Weibull(50,0.8),control_ecurve=Weibull(50,0.8),
rcurve=recruit, assess=10,iterations=1,seed=12345,detailed_output=TRUE)

fit_tte_data(data=example_data,Time="Time",Event="Censored",censoringOne=TRUE,type="automatic")

gestate documentation built on Feb. 20, 2020, 5:08 p.m.