View Source Chi2fit.MonteCarlo (Chi-SquaredFit v2.0.2)

Link to this section 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.

Link to this section Functions

Link to this function

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

View Source
@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.

Link to this function

forecast_duration(data, size)

View Source
@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

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
Link to this function

forecast_items(data, periods)

View Source
@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

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
Link to this function

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

View Source
@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

Options

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

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

View Source