Helper function to check how well a set of smooth renewable curve parameters matches the supply-points from which the curve parameters are generated. In gcamdata, this function is used in combination with stats::optimize to minimize the error of the smooth renewable curve fit relative to the supply-points. Note that the first argument (curve.exponent) is the one that is changed by optimize when trying to minimize the error. The functional form of GCAM's smooth renewable resource curve is documented at: http://jgcri.github.io/gcam-doc/energy.html#renewable-resources

smooth_res_curve_approx_error(
  curve.exponent,
  mid.price,
  base.price,
  maxSubResource,
  supply_points
)

Arguments

curve.exponent

smooth renewable resource curve shape parameter, numeric

mid.price

the price at which 50 percent of the maximum available resource is produced, numeric

base.price

the minimum cost of producing (generating electricity from) the resource

maxSubResource

the maximum quantity of energy that could be produced at any price, numeric

supply_points

a tibble of price and supply points along a resource curve in a region, numeric

Value

cross product of errors