Chi2fit.MonteCarlo (Chi-SquaredFit v3.1.0)

Copy Markdown View Source

Summary

Functions

Forecasts how many time periods are needed to complete size items

Returns a function for forecasting the duration to complete a number of items.

Returns a function for forecasting the number of completed items in a number periods.

Basic Monte Carlo simulation to repeatedly run a simulation multiple times.

Performs a nested bootstrap on sample data.

Functions

forecast(fun, size, tries \\ 0, update \\ fn -> 1 end)

@spec forecast(
  fun :: (-> non_neg_integer()),
  size :: pos_integer(),
  tries :: pos_integer(),
  update :: (-> number())
) :: number()

Forecasts how many time periods are needed to complete size items

Related functions: forecast_duration/2 and forecast_items/2.

forecast_duration(data, size)

@spec forecast_duration(data :: [number()] | (-> number()), size :: pos_integer()) ::
  (-> number())

Returns a function for forecasting the duration to complete a number of items.

This function is a wrapper for forecast/4.

Arguments

`data` - either a data set to base the forecasting on, or a function that returns (random) numbers
`size` - the number of items to complete

forecast_items(data, periods)

@spec forecast_items(data :: [number()] | (-> number()), periods :: pos_integer()) ::
  (-> number())

Returns a function for forecasting the number of completed items in a number periods.

This function is a wrapper for forecast/4.

Arguments

`data` - either a data set to base the forecasting on, or a function that returns (random) numbers
`periods` - the number of periods to forecast the number of completed items for

get_percentile(collection, value)

@spec get_percentile(list(), non_neg_integer()) :: float()

mc(iterations, fun, options \\ [])

@spec mc(
  iterations :: pos_integer(),
  fun :: (pos_integer() -> float()),
  options :: Keyword.t()
) ::
  {avg :: float(), sd :: float(), tries :: [float()]}
  | {avg :: float(), sd :: float()}

Basic Monte Carlo simulation to repeatedly run a simulation multiple times.

Options

`:collect_all?` - If true, collects data from each individual simulation run and returns this an the third element of the result tuple

nested_bootstrap(values, fun, options)

@spec nested_bootstrap([number()], ([number()] -> number()), Keyword.t()) :: [
  number()
]

Performs a nested bootstrap on sample data.

total_mc(result, fun, mode \\ :use_bounds, iterations \\ 1000)