knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This document covers the basic use of the package inflatably
.
When using costs in a cost analysis (e.g. cost-effectiveness calculation) there are several necessary considerations.
Often the specific cost with respect to time (and currency) is not available and so we need to inflate the observed cost to the desired target value for a given context.
We fill focus on context-dependent inflation. For further discussion and a focus on multiple currency inflation see [@Turner2019].
For original cost $C_0$, target cost $C_T$ and fraction yearly inflationary factor $i$ for $n$ years, the general inflation formula is as follows.
$$ C_T = (1 + i_{1})(1 + i_{2}) \cdots (1 + i_{n}) \times C_0 $$
Clearly, for the same $i$ each year this simplifies to
$$ C_T = C_0(1 + i)^n $$
The values of $i$ are context dependent, e.g. different for salaries or resources. So, to be more precise, we can explicitly denote the inflation factor as $i^s_{y_j}$ where $s$ indicates the source (corresponding to the context) and $y_j$ is the year from which a inflation factor is taken.
$$ C_T = (1 + i^s_{y_1})(1 + i^s_{y_2}) \cdots (1 + i^s_{y_n}) \times C_0 $$
In this example we inflate the original cost £1 observed in 2014 to 2016 prices using the Hospital and Community Health Services (HCHS) inflation rates.
library(inflatably) inflation_adjust_cost_data(from_year = 2014, to_year = 2016, from_cost = 1, inflation_df_nm = "HCHS") 1*1.004*1.01
The function returns the inflated cost and also records the inflation source, original year and cost and target year for reproducability.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.