plotSARanks: Plot ranks from an uncertainty/sensitivity analysis

Description Usage Arguments Details Value See Also Examples

View source: R/coin_sensitivity.R

Description

Plots the ranks resulting from an uncertainty and sensitivity analysis, in particular plots the median, and 5th/95th percentiles of ranks.

Usage

1
2
3
4
5
6
7
plotSARanks(
  SAresults,
  plot_units = NULL,
  order_by = "nominal",
  dot_colour = NULL,
  line_colour = NULL
)

Arguments

SAresults

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

plot_units

A character vector of units to plot. Defaults to all units. You can also set to "top10" to only plot top 10 units, and "bottom10" for bottom ten.

order_by

If set to "nominal", orders the rank plot by nominal ranks (i.e. the original ranks prior to the sensitivity analysis). Otherwise if "median", orders by median ranks.

dot_colour

Colour of dots representing median ranks.

line_colour

Colour of lines connecting 5th and 95th percentiles.

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 rank confidence intervals, 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
23
# 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(
  impute = list(imtype = c("indgroup_mean", "ind_mean", "none")),
  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 = 20,
                         SA_type = "UA")

# plot rank intervals
plotSARanks(SAresults)

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