weightedSum: Weighted sum of evaluations of alternatives.

View source: R/weightedSum.R

weightedSumR Documentation

Weighted sum of evaluations of alternatives.

Description

Computes the weighted sum of the evaluations of alternatives, stored in a performance table, with respect to a vector of criteria weights.

Usage

weightedSum(performanceTable, criteriaWeights, 
      alternativesIDs = NULL, criteriaIDs = NULL)

Arguments

performanceTable

Matrix or data frame containing the performance table. Each row corresponds to an alternative, and each column to a criterion. Rows (resp. columns) must be named according to the IDs of the alternatives (resp. criteria).

criteriaWeights

Vector containing the weights of the criteria. The elements are named according to the IDs of the criteria.

alternativesIDs

Vector containing IDs of alternatives, according to which the performance table should be filtered.

criteriaIDs

Vector containing IDs of criteria, according to which the performance table should be filtered.

Value

The function returns a vector containing the weighted sum of the alternatives with respect to the criteria weights.

Examples

performanceTable <- matrix(runif(3*4), ncol=3)

row.names(performanceTable) <- c("x1","x2","x3","x4")

colnames(performanceTable) <- c("g1","g2","g3")

weights <- c(1,2,3)

names(weights) <- c("g1","g2","g3")

overall1 <- weightedSum(performanceTable, weights)

overall2 <- weightedSum(performanceTable, weights, 
      alternativesIDs <- c("x2","x3"), criteriaIDs <- c("g2","g3"))

paterijk/MCDA documentation built on April 7, 2023, 8:31 p.m.