This repository contains a template for performing risk analysis with multivariate Monte Carlo simulations in R using the mc2d package.
data.csv
: Input data file containing disease information and parameters.custom_functions.R
: Custom R functions for data manipulation and visualization.model.R
: Main R script for running the risk analysis model.
-
Open
risk_analysis_template.Rproj
in RStudio (recommended). -
Alternatively, set your working directory to the project folder.
-
Install required packages:
install.packages(c("mc2d", "ggplot2", "dplyr", "tidyr"))
You can modify the data.csv
and model.R
script to adjust parameters, add new variables, or create additional visualizations as needed for your specific risk analysis scenario.
The custom_functions.R
file contains helper functions for:
-
Summarizing Monte Carlo nodes
-
Converting Monte Carlo data to long format
-
Creating boxplots for Monte Carlo results