synthesize: Synthesize Monte-Carlo scenarios

View source: R/synthesize.R

synthesizeR Documentation

Synthesize Monte-Carlo scenarios

Description

This function takes as input an object of class antaresData containing detailed results of a simulation and creates a synthesis of the results. The synthesis contains the average value of each variable over Monte-Carlo scenarios and eventually other aggregated statistics

Usage

synthesize(x, ..., prefixForMeans = "", useTime = TRUE)

Arguments

x

an object of class antaresData created with readAntares and containing detailed results of an Antares simulation.

...

Additional parameters indicating which additional statistics to produce. See details to see how to specify them.

prefixForMeans

Prefix to add to the columns containing average values. If it is different than "", a "_" is automatically added.

useTime

use times columns for synthesize.

Details

Additional statistics can be asked in three different ways:

  1. A character string in "min", "max", "std", "median" or "qXXX" where "XXX" is a real number between 0 and 100. It will add for each column respectively the minimum or maximum value, the standard deviation, the median or a quantile.

  2. A named argument whose value is a function or one of the previous aliases. For instance med = median will calculate the median of each variable. The name of the resulting column will be prefixed by "med_". Similarly, l = "q5" will compute the 5 each variable and put the result in a column with name prefixed by "l_"

  3. A named argument whose value is a list. It has to contain an element fun equal to a function or an alias and optionally an element only containing the names of the columns to which to apply the function. For instance med = list(fun = median, only = c("LOAD", "MRG. PRICE")) will compute the median of variables "LOAD" and "MRG. PRICE". The result will be stored in columns "med_LOAD" and "med_MRG. PRICE".

The computation of custom statistics can take some time, especially with hourly data. To improve performance, prefer the third form and compute custom statistics only on a few variables.

Value

Synthetic version of the input data. It has the same structure as x except that column mcYear has been removed. All variables are averaged across Monte-Carlo scenarios and eventually some additional columns have been added corresponding to the requested custom statistics.

Examples

## Not run: 
mydata <- readAntares("all", timeStep = "annual")

synthesize(mydata)

# Add minimum and maximum for all variables
synthesize(mydata, "min", "max")

# Compute a custom statistic for all columns
synthesize(mydata, log = function(x) mean(log(1 + x)))

# Same but only for column "LOAD"
synthesize(mydata,
           log = list(fun = function(x) mean(log(1 + x)),
                      only = "LOAD"))

# Compute the proportion of time balance is positive

synthesize(mydata, propPos = list(fun = function(x) mean(x > 0),
                                  only = "BALANCE"))

# Compute 95% confidence interval for the marginal price
synthesize(mydata,
           l = list(fun = "q2.5", only = "MRG. PRICE"),
           u = list(fun = "q97.5", only = "MRG. PRICE"))

## End(Not run)


rte-antares-rpackage/antaresProcessing documentation built on June 30, 2024, 2:28 a.m.