weighted_dose_costs: Compute weighted drug cost over a distribution of...

Description Usage Arguments Details Value Examples

View source: R/convenience.R

Description

Compute weighted drug cost over a distribution of characteristics

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
weighted_dose_costs(dist, params, var_base, dose_base, dose_multiplier,
  available_units, subset_col, subset_val, share_vials, qmin = 0.01,
  qmax = 0.99, by = 0.01)

weighted_norm_dose_costs(mean, sd, var_base, dose_base, dose_multiplier,
  available_units, subset_col, subset_val, share_vials, qmin = 0.01,
  qmax = 0.99, by = 0.01)

weighted_lognorm_dose_costs(meanlog, sdlog, var_base, dose_base,
  dose_multiplier, available_units, subset_col, subset_val, share_vials,
  qmin = 0.01, qmax = 0.99, by = 0.01)

Arguments

dist

distribution for the dose-determining variable

params

arguments for the quantile function for dist

var_base

see details

dose_base

see details

dose_multiplier

see details

available_units

available sizes and costs; must have column names 'size' and 'cost'

subset_col

optionally, a subset to select on in available_units

subset_val

if subset_col exists, the value to select

share_vials

should vials be shared (or, looked at from the other side, should any drug be allowed to go unused?)

qmin, qmax, by

determine the sequence of quantiles of the variable at which the dose function will be evaluated

mean

mean of normal distribution

sd

sd of normal distribution

meanlog

mean of lognormal distribution

sdlog

sd of lognormal distribution

Details

Typical use for these functions are when dose varies by some patient characteristic, for example weight or body surface area.

The general formula is dose = base_dose + dose_multiplier * pmax(0, var - var_base), and the number of vials is then computed using find_least_cost_partition().

Changing the percentiles at which the doses are calculated by changing qmin, qmax, and by will produce slightly different values, but the values will converge if

The functions weighted_norm_dose_costs() and weighted_lognorm_dose_costs() are provided to cover two common cases.

Value

the weighted dose cost

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
vialCost <- data.frame(treatment = "fake", 
                      size = c(50, 250), 
                      cost = c(2521, 12297)
                      )
weighted_dose_costs("norm", params = c(mean = 1.85, sd = 0.25),
                    var_base = 0, 
                    dose_base = 0, 
                    dose_multiplier = 320, 
                    vialCost, "treatment", "fake",
                    share_vials = FALSE)
vialCost <- data.frame(treatment = "fake", 
                      size = c(50, 250), 
                      cost = c(2521, 12297)
                      )
weighted_norm_dose_costs(1.85, 0.25, 
                         var_base = 0, dose_base = 0, 
                         dose_multiplier = 320, vialCost, "treatment", "fake",
                         share_vials = FALSE)

vialCost <- data.frame(treatment = "fake", size = 50, cost = 1000)
weighted_lognorm_dose_costs(4.3423559, 0.2116480, 
                            var_base = 50, dose_base = 100, 
                            dose_multiplier = 2, vialCost, "treatment", "fake",
                            share_vials = FALSE)
weighted_lognorm_dose_costs(4.3423559, 0.2116480, 
                            var_base = 50, dose_base = 100, 
                            dose_multiplier = 2, vialCost, "treatment", "fake",
                            share_vials = TRUE)

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