View source: R/event_prediction.R
fit_tte_data_prior | R Documentation |
This is a function to fit Weibull curves to patient-level Survival data integrating (weighted) prior data.
Where relevant prior data is available, this function can increase the precision of curve fitting, particularly in cases where there is low data maturity.
fit_tte_data_prior(
data,
Time = "Time",
Event = "Event",
censoringOne = FALSE,
type = c("Weibull"),
priordata,
priorTime = Time,
priorEvent = Event,
priorcensoringOne = censoringOne,
priorweight = 1,
init = NULL
)
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 "Weibull", the only type currently accepted |
priordata |
The dataframe object containing a patient-level prior dataset. Where a patient-level prior data set is not readily available, the function create_tte_prior can be used to create one from summary parameters. Naming and format of time and event columns should match that of 'data'. Default=NULL (no prior data) |
priorTime |
The column name for the prior times. Default is the same value as Time |
priorEvent |
The column name for the prior events (i.e. the binary variable denoting events vs censorings). Default is the same value as Event |
priorcensoringOne |
Specify whether censoring is denoted in the prior Event column by a one (TRUE) or zero (FALSE). Default is the same as censoringOne |
priorweight |
The weight to assign the prior data; a non-negative number, where 0 corresponds to no weight, i.e. ignore prior data, and 1 corresponds to equal weighting of prior and observed data. The prior weight should typically not be greater than 1. Default=1 (prior patients weighted equivalently to observed data) |
init |
Vector of starting values for parameter values; useful if survreg experiences convergence issues. Default=NULL (no values specified) |
This function is primarily used by the event_prediction_prior function, but also useful for Weibull curve fitting across two patient-level data sets.
If a patient-level prior data set is not available, use the create_tte_prior function to create an artificial one from a distribution.
Note that this may cause a small amount of over-precision; this may be minimised by deriving the prior data using a different distribution or specifying down-weighting.
Returns a 3-item list providing information needed to define a Curve object:
"Item 1"The type of Curve object fitted.
"Item 2"A list of fitted parameters for the curve type.
"Item 3"A vector containing the covariance-matrix parameters for the curve type.
"Item 4"A data frame containing the goodness of fit metrics for each curve type.
James Bell
Bell J, unpublished work. D Fink, A Compendium of Conjugate Priors, 1997
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,Event="Event",
censoringOne=FALSE)
example_prior <- create_tte_prior(curve=Weibull(alpha=100,beta=0.8),duration=20,events=50)
fit_tte_data_prior(data=example_data,priordata=example_prior,priorweight=0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.