#' Calculate the nevitable Policy Response (IPR)
#'
#' @param plan_x What is this?
#' @param scen_start What is this?
#' @param scen_end What is this?
#' @param year_x What is this?
#' @param year_start What is this?
#' @param year_end What is this?
#'
ipr_technology <- function(plan_x, scen_start, scen_end, year_x, year_start, year_end) {
relative_prod <- (scen_end - plan_x) / (scen_end - scen_start)
relative_time <- (year_end - year_start) / (year_end - year_x)
max(c(0, relative_prod * relative_time))
}
ipr_technology(
plan_x = 100,
scen_start = 200,
scen_end = 150,
year_x = 2040,
year_start = 2020,
year_end = 2025
)
#> [1] 0.3333333
ipr_technology(
plan_x = 300,
scen_start = 200,
scen_end = 150,
year_x = 2040,
year_start = 2020,
year_end = 2025
)
#> [1] 0
Created on 2021-08-03 by the reprex package (v2.0.0)