https://github.com/paulgovan/pra
Project Risk Analysis
https://github.com/paulgovan/pra
causal-networks contingency-analysis monte-carlo-simulation r risk-analysis sensitivity-analysis
Last synced: over 1 year ago
JSON representation
Project Risk Analysis
- Host: GitHub
- URL: https://github.com/paulgovan/pra
- Owner: paulgovan
- License: other
- Created: 2024-06-15T02:56:42.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-11T18:45:27.000Z (over 1 year ago)
- Last Synced: 2025-04-11T19:49:28.676Z (over 1 year ago)
- Topics: causal-networks, contingency-analysis, monte-carlo-simulation, r, risk-analysis, sensitivity-analysis
- Language: R
- Homepage: https://paulgovan.github.io/PRA/
- Size: 3.91 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
## PRA
{width=25%}
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://CRAN.R-project.org/package=PRA)
[](https://cran.r-project.org/web/checks/check_results_PRA.html)
[](https://cran.r-project.org/package=PRA)
[](https://cran.r-project.org/package=PRA)
[](https://doi.org/10.32614/CRAN.package.PRA)
## Key features:
* Second Moment Analysis
* Monte Carlo Simulation
* Contingency Analysis
* Sensitivity Analysis
* Earned Value Management
* Learning Curves
* Design Structure Matrices
## Installation
To install the release verion of PRA, use:
``` r
install_packages('PRA')
```
You can install the development version of PRA like so:
``` r
devtools::install_github('paulgovan/PRA')
```
## Usage
Here is a basic example which shows you how to solve a common problem using Monte Carlo Simulation.
First, load the package:
``` {r}
library(PRA)
```
Next, set the number of simulations and describe probability distributions for 3 work packages:
```{r}
num_simulations <- 10000
task_distributions <- list(
list(type = "normal", mean = 10, sd = 2), # Task A: Normal distribution
list(type = "triangular", a = 5, b = 10, c = 15), # Task B: Triangular distribution
list(type = "uniform", min = 8, max = 12) # Task C: Uniform distribution
)
```
Then, set the correlation matrix between the 3 work packages:
```{r}
correlation_matrix <- matrix(c(
1, 0.5, 0.3,
0.5, 1, 0.4,
0.3, 0.4, 1
), nrow = 3, byrow = TRUE)
```
Finally, run the simulation using the `mcs` function:
```{r}
results <- mcs(num_simulations, task_distributions, correlation_matrix)
```
To calculate the mean of the total duration:
```{r, results='asis'}
cat("Mean Total Duration is ", round(results$total_mean, 2))
```
To calculate the variance of the total duration:
```{r, results='asis'}
cat("Variance around the Total Duration is ", round(results$total_variance, 2))
```
To build a histogram of the total duration:
```{r}
hist(results$total_distribution, breaks = 50, main = "Distribution of Total Project Duration",
xlab = "Total Duration", col = "skyblue", border = "white")
```
## More Resources
Much of this package is based on the book [Data Analysis for Engineering and Project Risk Managment](https://doi.org/10.1007/978-3-030-14251-3) by Ivan Damnjanovic and Ken Reinschmidt and comes highly recommended.
## Code of Conduct
Please note that the PRA project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.