Home page

Discounting is a financial technique used to determine the present value of future cash flows or benefits, considering the time value of money. It’s based on the idea that a sum of money today is worth more than the same sum in the future, due to the potential for earning interest or the influence of inflation. By applying a discount rate, we can adjust future values to their present worth, making it easier to compare financial benefits or costs occurring at different times.

Why Use Discounting?

Discounting is widely used across various fields, from finance and economics to environmental sciences and public health. It is essential when assessing projects, investments, or policies that have long-term impacts. For example, in evaluating life expectancy, discounting helps to represent the current worth of future life years. This approach allows for better-informed decision-making by giving appropriate weight to benefits or costs occurring over time.

The Discounting Formula

The basic formula for discounting a future value is as follows:

\[ PV = \frac{FV}{(1 + r)^t} \]

where: \(PV\): Present Value, \(FV\): Future Value, \(r\): Discount Rate, and \(t\): Time in years, with for the current year \(t=0\).

Example Calculation

Consider a scenario where we want to calculate the present value of a life expectancy of 84 years with a 3% discount rate. By applying the formula iteratively for each year, we sum the discounted values over the life expectancy to find the total present worth of these years.

This document will walk you through practical examples of discounting in R, using functions and packages that simplify the computation and visualization of discounted cash flows and benefits.

Define a discounting function in R

discount <- function(values, rate, year) {
  # Calculate discounted values
  discounted_values <- values / ((1 + rate) ^ year)
  return(discounted_values)
}

Example with costs and benefits over time

# Example data: costs and QALYs over 11 years
years <- 0:11  # Time periods from 0 to 10 (11 years)

# Set the yearly discount rate (e.g., 1.5% or 3%)
discount_rate <- 0.015

# fixed values
costs <- rep(1000, length(years))  # Example costs per year
qalys <- rep(1, length(years))     # Example QALYs per year

# Apply discounting
discounted_costs <- discount(costs, discount_rate, years)
discounted_qalys <- discount(qalys, discount_rate, years)

# Display the results
discounted_data <- data.frame(
  Year = years,
  Costs = costs,
  Discounted_Costs = discounted_costs,
  QALYs = qalys,
  Discounted_QALYs = discounted_qalys
)

print(discounted_data)
##    Year Costs Discounted_Costs QALYs Discounted_QALYs
## 1     0  1000        1000.0000     1        1.0000000
## 2     1  1000         985.2217     1        0.9852217
## 3     2  1000         970.6617     1        0.9706617
## 4     3  1000         956.3170     1        0.9563170
## 5     4  1000         942.1842     1        0.9421842
## 6     5  1000         928.2603     1        0.9282603
## 7     6  1000         914.5422     1        0.9145422
## 8     7  1000         901.0268     1        0.9010268
## 9     8  1000         887.7111     1        0.8877111
## 10    9  1000         874.5922     1        0.8745922
## 11   10  1000         861.6672     1        0.8616672
## 12   11  1000         848.9332     1        0.8489332
print(colSums(discounted_data[,-1]))
##            Costs Discounted_Costs            QALYs Discounted_QALYs 
##      12000.00000      11071.11779         12.00000         11.07112

Example on discounted life expectancy

To calculate the discounted value of expected life years, we use the formula for a finite sum of discounted values over a defined period:

\[ PV = \sum_{t=0}^{n-1} \frac{1}{(1 + r)^t} \]

where: \(PV\): Present Value , \(n\): Total number of years, \(r\): Discount Rate, and \(t\): Time in years.

# Set some examples
life_expectancy <- c(84, 50, 10, 2)  # years 

# Set the yearly discount rate (e.g., 1.5%)
discount_rate <- 0.015

# Apply discounting
discounted_life_expectancy <- numeric(length=length(life_expectancy))

# loop over all values in the vector 'life expectancy'
for(i in 1:length(life_expectancy)){
  # per expected life year, add the discounted valued of year 'j'
  # note that we start with year '0', so the discounted value of the initial year equals 1
  for(j in 0:(life_expectancy[i]-1)){
  discounted_life_expectancy[i] <- discounted_life_expectancy[i] + discount(1, discount_rate, j)
  }
}

# Display the results
discounted_data <- data.frame(
  Life_expectancy = life_expectancy,
  Discounted_life_expectancy = discounted_life_expectancy
)

print(discounted_data)
##   Life_expectancy Discounted_life_expectancy
## 1              84                  48.292313
## 2              50                  35.524683
## 3              10                   9.360517
## 4               2                   1.985222

Home page