utility_by_time_from_death: Calculate utilities based on time before death

Description Usage Arguments Value Examples

View source: R/convenience.R

Description

Calculate utilities based on time before death

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
utility_by_time_from_death(x, ...)

## S3 method for class 'cycle_counts'
utility_by_time_from_death(x, util_before_death,
  util_long_before_death, death_state = "Death", discount_rate = 0, ...)

## S3 method for class 'eval_strategy'
utility_by_time_from_death(x, ...)

## S3 method for class 'run_model'
utility_by_time_from_death(x, m, ...)

Arguments

x

an object of of type cycle_counts, eval_model, or run_models. x is either a matrix of counts for from a model. (of type cycle_counts) or an eval_model or a run_models list.

...

other arguments to be passed through

util_before_death

a matrix with two columns, through_cycle and util. From through_cycle[i - 1] (or 1, for i = 1) to through_cycle[i+1] before death, an individual will accrue util[i] units of utility.

util_long_before_death

utility more than max(util_before_death[, through_cycle]) cycles before death.

death_state

the name of the state representing death.

discount_rate

discount rate to be applied to utilities.

m

name or number of a model, only if x is of type run_models.

Value

a vector of utilities, of length nrow(counts).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
ProgFree <- round(1000 * exp(-0.4 * 0:24))
Progressive <- round((1000 - ProgFree) * exp(-0.4 * 0:24))
Death <- 1000 - ProgFree - Progressive
state_names <- rep(c("ProgFree", "Progressive", "Death"), each = 25)

counts <- data.frame(.strategy = rep("s1", 25),
                     markov_cycle = 0:24,
                     state_names = state_names,
                     count = c(ProgFree, Progressive, Death)
)
class(counts) <- c("cycle_counts", class(counts))
aa1 <- data.frame(until_lag = c(1,2,3), util = c(0.1, 0.3, 0.5))
 utility_by_time_from_death(counts, util_before_death = aa1, 
   util_long_before_death = 1)

MattWiener/heemodFits documentation built on May 19, 2019, 8:21 a.m.