0.0
The project is in a healthy, maintained state
Forecast processes using monte-carlo simulation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

mc_forecast

Gem Version Gem Downloads GitHub Workflow Status Code Climate maintainability

Use Monte-Carlo methods for business forecasting. Define transition methods (for example a month-based one) and keep track of events you are interested in. Automatically generates a 95% confidence interval and mean values.


  • Quick start
  • Support
  • License
  • Code of conduct
  • Contribution guide

Quick start

gem install mc_forecast
require "mc_forecast"
# all arguments optional
e = McForecast::Simulation.new.run(init_state: nil, steps: 1, trials: 1_000) do |_state, _step, _trial|
  events = {}
  events[:coin] = rand > 0.5 ? 1 : 0

  # block should return a new state and a hash of events
  [nil, events]
end
# e[:coin][:mean][0] ~ 0.5
# e[:coin][:quantiles][0.025][0] ~ 0
# e[:coin][:quantiles][0.975][0] ~ 1

Support

If you want to report a bug, or have ideas, feedback or questions about the gem, let me know via GitHub issues and I will do my best to provide a helpful answer. Happy hacking!

License

The gem is available as open source under the terms of the MIT License.

Code of conduct

Everyone interacting in this project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Contribution guide

Pull requests are welcome!