Create Custom Monte Carlo Simulations for Strategic Business Decisions
Turn uncertain business decisions into rigorous risk analysis:
# Browse templates to get started
npx monte-carlo-simulator list
# Create your custom simulation (no coding required!)
npx monte-carlo-simulator create --interactive
# OR: Copy a template and modify it for your business
curl -O https://raw.githubusercontent.com/rmurphey/monte-carlo-simulator/main/examples/simulations/simple-roi-analysis.yaml
# Edit the YAML file with your parameters, then run:
npx monte-carlo-simulator run simple-roi-analysis --set initialInvestment=100000You Get: Confidence intervals like "75% chance of $200K+ savings, 15% chance of breaking even, 10% chance of loss"
Instead Of: Vague statements like "AI tools will probably save money"
๐ฏ Primary Purpose: Create custom Monte Carlo simulations for YOUR business decisions using proven templates - no coding, data science expertise, or complex setup required!
You're facing strategic business decisions with uncertainty:
- "Should we hire 5 developers or invest in automation tools?"
- "When will this marketing campaign pay for itself?"
- "What happens to our runway if growth slows down?"
- "Is this $200K technology investment worth the risk?"
Traditional approaches fall short:
- ๐ Spreadsheets: Static, single-point estimates that miss risk ("We'll definitely get 10x ROI")
- ๐คท Gut feeling: No data backing your $500K decision ("It feels right")
- ๐ Basic projections: "Best case we make $X" (but what about worst case?)
Turn uncertain business questions into rigorous risk analysis with confidence intervals:
Instead of: "Marketing will probably generate 10x ROI"
Get: "Marketing has 70% chance of 5-15x ROI, 20% chance of 2-5x ROI, 10% chance of loss"
Instead of: "Hiring 5 devs will increase velocity"
Get: "5 devs: 80% chance of 2.8x velocity, 20% chance of 1.2x due to coordination overhead"
Instead of: "AI tools will save money"
Get: "AI tools: 75% chance of $200K+ annual savings, 15% chance of breaking even, 10% chance of $30K annual loss"
- CTOs/Engineering Leaders: Technology investment ROI with working examples
- Startup Founders: Resource allocation models with proven templates
- Product Managers: Feature prioritization using battle-tested simulations
- Business Analysts: Risk assessment with copy-modify workflow
- AI Agents/Developers: Programmatic simulation generation from examples
PRIMARY WORKFLOW: Copy a template โ Modify for your business โ Run analysis
No coding, data science, or complex setup required!
# Browse 9+ proven templates for different business decisions
npx monte-carlo-simulator list
# Examine any template's customizable parameters
npx monte-carlo-simulator run technology-investment --list-params# Interactive creation (guided workflow)
npx monte-carlo-simulator create --interactive
# OR: Copy any example YAML file
curl -O https://raw.githubusercontent.com/rmurphey/monte-carlo-simulator/main/examples/simulations/simple-roi-analysis.yaml
# Edit the YAML file with your business parameters
# Change investment amounts, team sizes, time periods, etc.# Validate your changes (if you downloaded the file)
npx monte-carlo-simulator validate examples/simulations/simple-roi-analysis.yaml
# Run with your parameters - includes comprehensive Monte Carlo visualizations
npx monte-carlo-simulator run simple-roi-analysis
# Override parameters on the fly
npx monte-carlo-simulator run simple-roi-analysis --set initialInvestment=250000
# Get detailed statistical analysis with histograms for all outputs
npx monte-carlo-simulator run simple-roi-analysis --verboseEvery simulation includes comprehensive visual analysis:
- ๐ Confidence Intervals: Visual representation of outcome ranges (P10, P50, P90)
- ๐ Histogram Distributions: ASCII bar charts showing probability distributions
- โก Risk Analysis: Probability of loss, Value at Risk (95%, 99%), Expected Shortfall
- ๐ Statistical Summaries: Complete percentile breakdowns and business interpretations
# Example output includes:
# ๐ฒ MONTE CARLO ANALYSIS
# ๐ ROI Percentage - Confidence Intervals
# ๐ ROI Percentage [histogram with probability percentages]
# โก ROI Percentage - Risk Analysis- ROI Analysis: Investment returns with uncertainty modeling
- Team Scaling: Hiring decisions with coordination overhead
- Technology Investment: Tool adoption with productivity gains
- Marketing Campaigns: Multi-channel ROI with customer acquisition
- Quality Assurance: Manual vs automated testing strategies
- Sales Operations: Outbound sales team effectiveness
Templates are fully-working examples designed to be copied and customized for your specific business parameters.
โจ AI Agents: Perfect for programmatic business analysis generation!
- โ Decisions under $10K (overkill for small decisions)
- โ Completely deterministic problems (no uncertainty to model)
- โ Immediate decisions (analysis takes time to set up and run)
- โ When you have dedicated data science team with specialized tools
Most users don't need this - the npx commands above work immediately without any setup!
# Clone and set up the framework
git clone https://github.com/rmurphey/monte-carlo-simulator
cd monte-carlo-simulator
# Install dependencies and build
npm install
npm run build
# Verify installation
npm run cli --help
# Start web development server with hot reload
npm run dev:web # Runs headless by default
npm run dev:web:open # Opens browser at http://localhost:3000Interactive web interface with full access to all simulation templates:
# Start web interface (headless by default)
npm run dev:web
# Or open in browser for development
npm run dev:web:open
# Access directly with simulation parameter
# http://localhost:3000/?simulation=simple-roi-analysisWeb Interface Features:
- Simulation Selector: Dropdown with 9+ available simulation templates
- Dynamic Parameter Forms: Parameters update automatically based on selected simulation
- Value Preservation: Compatible parameter values preserved when switching simulations
- URL Parameter Support: Direct simulation loading via
?simulation=template-name - Complete Visualization: Charts, statistics, and configuration management
- Professional UI: Clean, responsive interface matching existing design system
Development Features:
- Instant Hot Reload: Changes to HTML, CSS, or TypeScript reflect immediately
- TypeScript Integration: Real-time compilation and error reporting
- Modern Tooling: Vite-powered development with optimized builds
- Headless by Default: Browser opens only when explicitly requested for development
If you encounter issues during installation:
# Check Node.js version (requires 16+)
node --version
# Clean install if dependencies fail
rm -rf node_modules package-lock.json
npm install
# Rebuild if TypeScript compilation fails
npm run build
# Test core functionality
npm run cli list
npm run testCommon Issues:
- Node.js version: Requires Node 16+ for TypeScript features
- Permission errors: Use
npm install(notsudo npm install) - Build failures: Run
npm run buildafter any code changes - Missing simulations: Verify you're in the project root directory
The framework is designed around copying and modifying working examples:
# Discover available simulations
npm run cli list
# Run any simulation with default parameters
npm run cli -- run simple-roi-analysis
# Override specific parameters
npm run cli -- run simple-roi-analysis --set initialInvestment=75000 --set monthlyBenefit=6000
# See all available parameters for any simulation
npm run cli -- run simple-roi-analysis --list-params
# Validate simulation configurations
npm run cli -- validate examples/simulations/simple-roi-analysis.yamlAdjust parameters in real-time and see results update instantly:
# Launch interactive mode for any simulation (terminal required)
npm run cli -- run simple-roi-analysis --interactive
# Interactive simulation selection
npm run cli interactive
# For non-terminal environments (Claude Code, CI/CD), use parameter flags:
npm run cli -- run simple-roi-analysis --set initialInvestment=500000 --set affectedEmployees=100Interactive Features:
- Real-time parameter adjustment - Change values and see immediate impact on results (terminal required)
- Before/after comparison - Track how parameter changes affect outcomes
- Parameter validation - Type checking and range enforcement with helpful error messages
- Dynamic parameter discovery - No static documentation to maintain
- Environment detection - Clear error messages with alternatives for unsupported environments
Create business simulations by copying and modifying working examples:
# Copy a relevant example to start
cp examples/simulations/simple-roi-analysis.yaml my-roi-analysis.yaml
# Validate your changes
npm run cli -- validate my-roi-analysis.yaml
# Run your custom simulation
npm run cli -- run my-roi-analysis.yaml
# Or create interactively
npm run cli create --interactiveExamples-First Benefits:
- Proven Patterns: Start from tested, working business simulations
- Copy-Modify Workflow: Professional approach - copy example, customize for your needs
- No Learning Curve: Skip complex configuration, focus on business logic
- Agent-Friendly: Ideal for AI-assisted simulation generation
- Battle-Tested: All examples validated and production-ready
# Discover available simulations
npm run cli list
# Run example simulations by ID
npm run cli run simple-roi-analysis
npm run cli run technology-investment
# Generate comprehensive analysis documents
npm run cli run simple-roi-analysis --format=document
npm run cli run technology-investment --format=document --output=analysis.md
# Interactive parameter exploration
npm run cli run simple-roi-analysis --interactive
# See all available commands
npm run cli --help# Simple ROI analysis - basic pattern for learning
npm run cli run examples/simulations/simple-roi-analysis.yaml
# Technology investment - realistic business decision
npm run cli run examples/simulations/technology-investment.yaml
# Team scaling - advanced with business intelligence
npm run cli run examples/simulations/team-scaling-decision.yaml
# QA strategy analysis - manual vs automated testing ROI
npm run cli run simulations/manual-qa-roi.yaml
npm run cli run simulations/qa-strategy-comparison.yaml
# Scenario analysis - compare risk scenarios
npm run cli run examples/simulations/ai-tool-adoption/ai-tool-adoption.yaml
npm run cli run examples/simulations/ai-tool-adoption/conservative.yaml
npm run cli run examples/simulations/ai-tool-adoption/aggressive.yamlExpected output:
๐ฌ Monte Carlo Simulation: AI Tool Adoption Analysis (Conservative)
๐ Results (1,000 iterations):
Annual Tool Cost ($): $10,800
Net Annual Benefit ($): $61,538 ยฑ $16,261
ROI Percentage: 570% ยฑ 151%
๐ฌ Monte Carlo Simulation: AI Tool Adoption Analysis (Aggressive)
๐ Results (1,000 iterations):
Annual Tool Cost ($): $4,800
Net Annual Benefit ($): $565,544 ยฑ $84,549
ROI Percentage: 11,782% ยฑ 1,761%
# See all available examples with agent-friendly patterns
ls examples/simulations/
cat examples/README.md
# Study the YAML structure that actually works
cat examples/simulations/simple-roi-analysis.yamlCopy and modify working examples:
# Based on proven working patterns
name: "Your Business Decision"
category: "Business"
description: "Analysis of your specific strategic decision with uncertainty modeling"
version: "1.0.0"
tags: [strategy, decision]
parameters:
- key: investment
label: "Investment Amount ($)"
type: number
default: 50000
simulation:
logic: |
const annualBenefit = investment * (0.15 + random() * 0.1)
const roi = ((annualBenefit - investment) / investment) * 100
return { roi: Math.round(roi * 10) / 10 }All examples are tested and working.
For AI Agents:
- Complete guide: docs/AGENT.md for specifications, patterns, and interactive exploration workflows
For Interactive Development: See docs/INTERACTIVE_STUDIO.md for the planned interactive simulation definition and real-time execution system.
- "AI tools will save money" โ Spend $50K/year hoping for the best
- "Hire 5 developers" โ $600K commitment based on gut feeling
- "Marketing campaign will work" โ $100K budget with crossed fingers
- AI Tool Decision: "75% chance of $200K+ savings, 10% chance of loss" โ Data-driven decision with risk assessment
- Hiring Decision: "5 devs have 20% chance of negative ROI due to coordination overhead" โ Consider smaller team or different structure
- Marketing Decision: "Campaign A has 60% success rate vs Campaign B's 40%" โ Choose better-odds campaign
- examples/ - Working simulation examples you can run and modify
- docs/CLI_REFERENCE.md - Complete CLI guide with examples and best practices
- docs/TECHNICAL.md - Framework architecture and advanced features
- docs/VALIDATION.md - Bulletproof validation system and error handling
- docs/AGENT.md - Complete technical specifications, working patterns, schema requirements
- examples/README.md - Detailed simulation patterns with validation rules
- Monte Carlo simulation engine with statistical analysis
- Business intelligence functions (ROI, payback period, runway calculations)
- YAML-based configuration with bulletproof validation
- TypeScript framework for complex custom logic
- Professional CLI with comprehensive parameter validation
- Production-grade reliability (92 passing tests with schema validation)
- Risk scenario comparison - Side-by-side analysis with
--compareflag - Export capabilities - JSON/CSV/Document output with
--formatand--outputoptions - Document generation - Comprehensive analysis reports with text-based visualizations
- Parameter overrides - Custom values via CLI arguments or parameter files
- Statistical analysis - P10/P50/P90 percentiles, mean, standard deviation
# Copy and modify existing examples
cp examples/simulations/simple-roi-analysis.yaml YOUR_SIMULATION.yaml
# Edit parameters and simulation logic
# Then run your custom simulation
npm run cli run YOUR_SIMULATION.yamlInteractive Config Editing - Full simulation development environment:
# Launch interactive session with complete config editing capabilities
npm run cli run examples/simulations/simple-roi-analysis.yaml --interactive
npm run cli run examples/simulations/technology-investment.yaml --interactive
# Interactive commands available in session:
# [r] Run simulation again [c] Edit full config [s] Save changes
# [e] Export results [h] Help [q] Quit
# Config editor sub-commands:
# [e] Edit full YAML in $EDITOR [t] Test config [u] Undo changes
# [r] Run with changes [b] Back to main menu
# Features:
# โ
External editor integration (nano, vim, VS Code, etc.)
# โ
Safe temporary files with automatic cleanup and backups
# โ
Config history with undo/redo functionality
# โ
Real-time validation and change detection
# โ
Perfect for rapid prototyping and iterative developmentInteractive Workflow Example:
# Start session - shows initial simulation results
npm run cli -- run simple-roi-analysis.yaml --interactive
# Enter config editing mode
> c
# Edit full YAML configuration
> e
# Opens config in your $EDITOR, make changes, save and exit
# Automatic validation shows what changed:
# ๐ Changes detected:
# โข Modified parameter: initialInvestment (100000 โ 250000)
# โข Updated simulation logic: added risk adjustment
# Test changes with quick 100-iteration run
> t
# Save changes permanently or undo if needed
> s # Save to original file with backup
> u # Undo changes and revertParameter Files - Batch analysis with custom values:
# Create parameter file with custom values
echo '{"initialCost": 75000, "adoptionRate": 0.8}' > my-scenario.json
# Run simulation with custom parameters
npm run cli run simulations/ai-investment-roi/baseline.yaml --params my-scenario.json --verbose
# Save results for analysis
npm run cli run simple-roi-analysis --params scenario.json --output results.json --iterations 5000Development Commands:
# Core development
npm run dev # Watch mode for CLI development
npm run build # Compile TypeScript
npm run test # Run full test suite (92 tests - all passing)
npm run test:watch # Run tests in watch mode
npm run test:coverage # Run tests with coverage report
# Web development
npm run dev:web # Vite development server headless (port 3000)
npm run dev:web:open # Vite development server with browser (port 3000)
npm run build:web:vite # Production web build with Vite
npm run preview:web # Preview production web build locally (headless)
npm run preview:web:open # Preview production web build with browser
npm run test:web # Test Vite development server and web interface
npm run test:all # Run both framework and web tests
# Code quality
npm run lint # Check for linting issues
npm run lint:fix # Auto-fix linting issues
npm run format # Format code with Prettier
npm run typecheck # TypeScript type checking
# Validation
npm run cli validate YOUR_SIMULATION.yaml # Bulletproof YAML validation with detailed errors
npm run validate:yaml # Validate all YAML files
npm run validate:json # Validate all JSON files
npm run test:docs # Test documentation examples
npm run test:agent-apis # Test agent API functionality
# CLI commands
npm run cli list # List available simulations
npm run sim # Quick interactive modesrc/
โโโ framework/ # Core Monte Carlo engine
โโโ cli/ # Command-line interface
โโโ examples/ # Working example simulations
โโโ test/ # Test cases and validation
examples/simulations/ # 7 working examples
โโโ simple-roi-analysis.yaml
โโโ technology-investment.yaml
โโโ team-scaling-decision.yaml
โโโ software-investment-roi.yaml
โโโ marketing-campaign-roi.yaml
โโโ ai-tool-adoption/ # Scenario examples
# Run simulations directly without installation
npx monte-carlo-simulator list
npx monte-carlo-simulator run simple-roi-analysis
npx monte-carlo-simulator run technology-investment --set toolCost=30000
# Parameter discovery and validation
npx monte-carlo-simulator run simple-roi-analysis --list-params
npx monte-carlo-simulator validate examples/simulations/simple-roi-analysis.yaml- NPM Package - Published and available via
npx monte-carlo-simulator - Local development - Full development environment available
- Zero installation - No setup required, works immediately
This project is designed for:
- Business professionals creating analysis templates
- Developers extending the framework capabilities
- AI agents generating simulations from natural language
- Add business scenarios by creating YAML configurations
- Improve existing examples with better parameters/logic
- Add industry-specific functions to the business intelligence library
- Write tests for new simulation patterns
"Used this to analyze whether to hire 3 senior developers or 5 junior developers. The coordination overhead modeling showed 3 seniors had 85% chance of better velocity. Saved $180K in salary costs." - CTO, Series B Startup
"Marketing campaign analysis showed our 'safe' strategy had lower expected value than the 'risky' one due to market timing. Switched strategies and hit 340% ROI instead of projected 180%." - Growth Lead, SaaS Company
"Runway analysis with multiple scenarios helped us decide between raising Series A vs extending runway. Monte Carlo showed 73% chance we'd hit milestones with current burn rate." - Founder, Pre-seed Startup
Transform risky business guesses into data-driven decisions with confidence intervals.
Every strategic question becomes a working simulation:
- "When does generative AI cost outweigh benefits?" โ Monte Carlo analysis with cost/benefit distributions
- "Should we hire 5 developers or invest in automation?" โ Risk-adjusted comparison with coordination modeling
- "What's the optimal team scaling strategy?" โ Multi-scenario analysis with velocity and cost projections
MIT License - See LICENSE file for details
Turn uncertainty into confidence. Make better business decisions with data.