mc_forecast
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!