Skip to contents

Fit distribution to match target usage using non-linear optimisation. This assumes an exponentially distributed net loss function and randomly correlated net distribution.

Usage

fit_usage(
  target_usage,
  target_usage_timesteps,
  distribution_timesteps,
  distribution_init = rep(0, length(distribution_timesteps)),
  distribution_lower = rep(0, length(distribution_timesteps)),
  distribution_upper = rep(1, length(distribution_timesteps)),
  timesteps = max(c(target_usage_timesteps, distribution_timesteps)),
  half_life = 5 * 365,
  ...
)

Arguments

target_usage

Target usage

target_usage_timesteps

Target usage time points

distribution_timesteps

A vector of distribution time steps

distribution_init

Starting distribution for optimiation

distribution_lower

Lower bound on distributions (default = 0)

distribution_upper

Upper bound on distribution (default = 1)

timesteps

Net loss vector

half_life

Net retention half life

...

Further arguments to pass to the cobyla

Value

Non-linear optimisation fit output