mcmodule! My R package for complex risk analysis

A few months ago, I published my first R package on CRAN. Now it has fewer bugs and more features, and I can finally share it with you: mcmodule v1.2.0 is out! 😀

mcmodule

R package for building modular Monte Carlo risk analysis models.

This package was born out of necessity and grew out of obsession. I developed it because I could not find any decent tools for creating complex risk analysis models (thousands of parameters, dozens of scenarios, and multiple pathways) in open-source epimiologist friendly tools. I had to write a lot of code to manage large and messy risk analysis, and at some point it went beyond what I could keep just for farmR!SK. So I decided to make it a separate project and turn it into an R package that could help other risk modellers.

mcmodule is a framework for building modular Monte Carlo risk models. It extends mc2d, making it easier to work with multiple risk pathways, variables, and scenarios. You can organise your analysis into flexible modules, run multivariate operations on Monte Carlo nodes, automate node creation, visualise your models as a network, and perform sensitivity and convergence analyses.

A few days ago, I presented it on R!sk 2026, the R consortium risk analysis conference. Here you can find the talk slides and the materials.

Some figures from my R!sk 2026 presentation.

This was my first time developing a CRAN package. Coming from data science, I’ll say that programming something other people will use was not easy. Big thanks to Wickham’s R Packages, Peng’s Mastering Software Development in R, ant the R community forums. And, although I’m not the biggest fan of GitHub anymore (they suspended my account for a week1), using Positron with GitHub Copilot definitely helped to jump from v1.1.0 to v1.2.0 (see mcmodule news).

The package is still under active development, and a paper about its contributions to risk analysis is being written. I’m adding new features and fixing bugs, and I would love to see it being used and to hear your feedback!💫

The phone is ringing
The clock keeps ticking
Just let me out
The phone is ringing
The world is spinning
I know

Dover, “Let Me Out” (2006)

  1. It was horrible😠. All my thesis projects were there. Of course I had local copies, but the situation still caused lots of stress. After a week, they apologised and reactivated it, but now I’m considering alternatives to GitHub. ↩︎

Posted

in

by

Tags: