weights2corr: Recalculate correlations and ranks based on new weights

Description Usage Arguments Details Value See Also Examples

View source: R/coin_rew8r.R

Description

This is a short cut function which takes a new set of indicator weights, and recalculates the COIN results based on these weights. It returns a summary of rankings and the correlations between indicators and index.

Usage

1
2
3
4
5
6
7
8
weights2corr(
  COIN,
  w,
  aglevs = NULL,
  icodes = NULL,
  cortype = "pearson",
  withparent = TRUE
)

Arguments

COIN

COIN object

w

Full data frame of weights for each level

aglevs

A 2-length vector with two aggregation levels to correlate against each other

icodes

List of two character vectors of indicator codes, corresponding to the two aggregation levels

cortype

Correlation type. Either "pearson" (default), "kendall" or "spearman". See stats::cor.

withparent

Logical: if TRUE, only correlates with the parent, e.g. sub-pillars are only correlated with their parent pillars and not others.

Details

This function is principally used inside rew8r(). The w argument should be a data frame of weights, of the same format as the data frames found in .$Parameters$Weights.

Value

A list where .$cr is a vector of correlations between each indicator and the index, and .$dat is a data frame of rankings, with unit code, and index, input and output scores

See Also

Examples

1
2
3
4
5
# build ASEM COIN up to aggregation
ASEM <- build_ASEM()
# get correlations between pillars (level 2) and index (level 4)
# original weights used just for demonstration, normally you would alter first.
l <- weights2corr(ASEM, ASEM$Parameters$Weights$Original, aglevs = c(2,4))

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