Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
108 lines (62 sloc) 3.19 KB
title: "Introduction to Arena2R"
author: "Pedro Nascimento de Lima"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Introduction to Arena2R}
```{r setup, include = FALSE}
collapse = TRUE,
comment = "#>"
## Exporting Arena Report Database
This is a basic example which shows you how to get your Arena results quickly into R. The basic idea is to run different scenarios and save each of them to a separate csv file. (Yes, you could use Process Analyzer (PAN) to run all scenarios, but to my knowledge, there's no way to get your data out of the PAN easily).
Follow these steps to get Arena simulation results to R:
* Run your model with n replications. Do not change the number of replications between scenarios.
* For each scenario, save a csv with simulation results clicking on "Tools > ReportDatabase > Export Summary Statistics to CSV File". Use the standard options. If Arena throws an error, then you'll have to figure out how to get your results into a csv file. Sometimes it's necessary to save the report database as a \*.mdb file before generating the csv file.
## Using the Shiny App
If you're not familiar to R, you can run this command on R Console and use the example app.
```{r running-the-arena2r-app, eval = FALSE}
After running this command, the app screen will pop up. You can upload your csv files and play around with the Confidence Interval and Scatter Plots.
## Using the Package with an R Script
* Open a new .R file, and run the following code:
```{r arena2r-example, eval = FALSE}
# Load the library:
# Define the path to your folder with Arena csv files. In my case, it's here:
my_path = system.file("extdata", package = "arena2r")
# Then, get a tidy results data.frame out of your files!
results = arena2r::get_simulation_results(my_path)
You can also play around with the arena_results dataset included in the package. To use it, follow these steps:
# Load the example dataset:
# Let's call it results
results = arena_results
After these steps, now you have a tidy data.frame with your results. Let's get into possible visualizations. Usually, you'll be interested in the mean confidence interval for some response variable, across scenarios.
```{r arena2r-confidence-interval-plot}
# Plot a Statistic confidence interval across scenarios for a response variable.
arena2r::plot_confint(sim_results = results, response_variable = "Entity 1.NumberOut")
Now let's explore the relationship between two variables, across scenarios and replications:
```{r arena2r-scatter-plot}
# Now let's plot analyse the relationship between two variables:
arena2r::plot_scatter(sim_results = results, x_variable = "Entity 1.NumberIn", y_variable = "Entity 1.NumberOut")
Finally, let's summarise every statistic across all scenarios.
```{r, warning=FALSE}
statistics_summary = arena2r::get_statistics_summary(sim_results = results, confidence = 0.95)
I hope you enjoyed the package.
You can’t perform that action at this time.