plotSA: Plot sensitivity indices

Description Usage Arguments Details Value See Also Examples

View source: R/coin_sensitivity.R

Description

Plots sensitivity indices as bar or pie charts.

Usage

1
plotSA(SAresults, ptype = "bar")

Arguments

SAresults

A list of sensitivity/uncertainty analysis results from sensitivity().

ptype

Type of plot to generate - either "bar", "pie" or "box".

Details

To use this function you first need to run sensitivity(). Then enter the resulting list as the SAresults argument here. See COINr online documentation for more details.

Value

A plot of sensitivity indices generated by ggplot2.

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# build ASEM COIN up to aggregation
ASEM <- build_ASEM()

# define noise to be applied to weights
nspecs <- data.frame(AgLevel = c(2,3), NoiseFactor = c(0.25,0.25))

# create list specifying assumptions to vary and alternatives
SAspecs <- list(
  normalise = list(ntype = c("minmax", "rank", "dist2max")),
  weights = list(NoiseSpecs = nspecs, Nominal = "Original")
)

# run uncertainty analysis
# here we set N deliberately much lower than normal to enable quick testing
# Would recommend in a practical case to increase to perhaps 500 (more is always better)
SAresults <- sensitivity(ASEM, v_targ = "Index",
                         SA_specs = SAspecs,
                         N = 5,
                         SA_type = "SA")

# Plot results as a bar chart
plotSA(SAresults, ptype = "bar")

COINr documentation built on Nov. 30, 2021, 9:06 a.m.