Stephen Wade
04 April 2017
An R package to assist in calculating cost-effectiveness analysis of a trial.
Provides three classes;
- Trial
,
- ExtendTria
l, and
- UtilityTrial
,
and provides generics for calculating (with or without discounting);
- life expectancy (lifeyear()
and dlifeyear()
), and
- quality-adjusted life expectancy (dqaly()
).
The base class Trial does not allow for any beyond-trial extension or censoring, and so life expectancy is given by the follow-up time, or discounted from the follow-up time.
The ExtendTrial class allows for a new follow-up time to be specified and accepts hazard data so that the life expectancy up to the new follow-up time can be estimated. Both censored and uncensored observations are accepted, where uncensored observations' (discounted) life-expectancy are given by the original (discounted) follow-up times.
The UtilityTrial class further allows for the specification of health states and the utility of those health states.
Discounting is applied continuously by exponential functions.
Hazard data is allowed to vary by outcome, and the hazard is assumed constant on each time interval specified, but is otherwise treated as a continuous function of time. Time interval data is continuous and not restricted to any discrete time scale (e.g. whole years etc).
Health state utilities, like hazard data, can vary by outcome, and are assumed constant within each health state time interval. The time interval data is continuous as per hazard time intervals.
All calculations are performed by exact integrals of, essentially, step-like functions for hazards and health state utility.
Given long-data from a trial, a Trial
class is created by specifying the
columns that describe participants, the columns that describe the outcomes and
the column that contains the follow-up time
A trivial example is
df <- data.frame(age=sample(c('55-59', '60-64'), 10, replace=T),
gender=sample(c('male', 'female'), 10, replace=T),
alive=sample(c(T, F), 10, replace=T),
fup_time=10*runif(10))
discount_rate <- 0.03
my_trial <- Trial(df,
~age + gender,
~alive,
fup_time,
discount_rate)
Accessor functions for the participant data, outcome data and follow-up data are given
participants(my_trial)
outcomes(my_trial)
lifeyear(my_trial)
dlifeyear(my_trial)
The name lifeyear
implies that the follow-up time was measured in years,
however the Trial
class does not interpret the follow-up data in any form of
units. The lifeyear
function is trivially returning the follow-up times.
The discounted life-year function dlifeyear
returns the (continuously)
discounted life-years of follow-up.
The ExtendTrial
class provides functions to estimate the beyond-trial life
expectancy, either discounted or undiscounted.
This code is licensed under the MIT license and you may use this package strictly under those terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.