library(agena.ai)
Setting the working directory to where we have the Models folder if needed
#setwd("/Users/user/repos/api-r")
Importing an existing model from a .cmpx file
<- from_cmpx("CarCosts.cmpx")
model <- model$networks[[1]] network
Creating a new dataSet in the model for sensitivity analysis
$create_dataSet(id = "sa") model
Creating a sensitivity analysis config object which uses all nodes for sensitivity analysis on the node total_cost, to calculate mean and variance results
<- create_sensitivity_config(
sa_config target="total_cost",
sensitivity_nodes="*",
dataset="sa",
report_settings = list(summaryStats = c("mean", "variance"))
)
Login to the agena.ai cloud servers and running the sensitivity analysis
<- login("test@example.com", "1234567890")
credentials
sensitivity_analysis(model, credentials, sa_config)