import drisk as drdrisk
drisk is a Python package for quick Monte Carlo modelling, with an emphasis on ergonomic distribution elicitation and model composability.
It is designed to make probabilistic models simple enough for quick scripts and notebooks, while still supporting more structured simulation workflows.
Key features include:
- univariate continuous and discrete distribution sampling
- percentile-based and parameter-based distribution elicitation
- composable Monte Carlo models using ordinary Python arithmetic
- correlated sampling with correlation matrices and copulas
- mixture distributions for combining multiple uncertainty regimes
- decision support workflows, including decision-tree rollback analysis
- one-at-a-time sensitivity analysis for comparing model input impacts
This documentation site collects runnable examples and report-style walkthroughs.
Quick start
Create a positive, right-skewed LogNormal distribution and plot it.
volume = dr.LogNormal.elicit(
lower=800,
upper=1_500,
confidence=0.8,
name="Monthly sales volume",
)
volume.plot(color="steelblue")
Create a PERT distribution from a minimum, most-likely, and maximum estimate.
margin = dr.PERT.elicit(
min=20,
mode=35,
max=60,
name="Unit margin",
)
margin.plot(color="darkorange")
Compose the distributions with ordinary Python arithmetic, then simulate the result.
monthly_profit = volume * margin
monthly_profit.name = "Simulated Monthly Profit"
samples = monthly_profit.sample(size=50_000, seed=42)
samples[:5]array([50041.11600797, 45977.5685894 , 48566.97041161, 38203.91838619,
18664.17584828])
monthly_profit.plot(color="seagreen")