Package 'waspasR'

Title: Tool Kit to Implement a W.A.S.P.A.S. Based Multi-Criteria Decision Analysis Solution
Description: Provides a set of functions to implement decision-making systems based on the W.A.S.P.A.S. method (Weighted Aggregated Sum Product Assessment), Chakraborty and Zavadskas (2012) <doi:10.5755/j01.eee.122.6.1810>. So this package offers functions that analyze and validate the raw data, which must be entered in a determined format; extract specific vectors and matrices from this raw database; normalize the input data; calculate rankings by intermediate methods; apply the lambda parameter for the main method; and a function that does everything at once. The package has an example database called choppers, with which the user can see how the input data should be organized so that everything works as recommended by the decision methods based on multiple criteria that this package solves. Basically, the data are composed of a set of alternatives, which will be ranked, a set of choice criteria, a matrix of values for each Alternative-Criterion relationship, a vector of weights associated with the criteria, since certain criteria are considered more important than others, as well as a vector that defines each criterion as cost or benefit, this determines the calculation formula, as there are those criteria that we want the highest possible value (e.g. durability) and others that we want the lowest possible value (e.g. price).
Authors: Flavio Barbara [cre, aut], Marcos Santos [ctb]
Maintainer: Flavio Barbara <[email protected]>
License: GPL (>= 2)
Version: 0.1.5
Built: 2025-03-05 05:33:03 UTC
Source: https://github.com/flavio-barbara/waspasr

Help Index


applyLambda

Description

Apply the lambda to assign a relative importance to each of the previously used methods (WSM and WPM). Lambda values range from zero to one

Usage

applyLambda(matrix_wsm, matrix_wpm, lambda)

Arguments

matrix_wsm

The data set object obtained from the application of the calcWSM function

matrix_wpm

The data set object obtained from the application of the calcWPM function

lambda

The lambda value (between 0 and 1)

Value

A data frame object that contains the alternatives set scored by and classified in descending order (from best to worst classified) according to the weighting proposed by the WASPAS method using the input lambda.


calcWPM

Description

Calculates the ranking for the alternative's set according to WPM method

Usage

calcWPM(normal_db, vec_weights)

Arguments

normal_db

A data set object with normalized values of Alternatives X Criteria

vec_weights

Contains a set of user assigned values to weight the criteria. The sum of these weights must add up to 1. The format of this input is an array of values.

Value

A data frame object that contains 2 columns and the the same number of rows as the input matrix. The columns "WPM_Rank" has the calculated relative value of each alternative whose id is in the "Alternative" column


calcWSM

Description

Calculates the ranking for the alternative's set according to WSM method.

Usage

calcWSM(normal_db, vec_weights)

Arguments

normal_db

A data set object with normalized values of Alternatives X Criteria

vec_weights

Contains a set of user assigned values to weight the criteria. The sum of these weights must add up to 1. The format of this input is an array of values.

Value

A data frame object that contains 2 columns and the the same number of rows as the input matrix. The column "WSM_Rank" has the calculated relative value of each alternative whose id is in the "Alternative" column


checkInputFormat

Description

Verify if the database to be submitted to WASPAS is correctly formatted

Usage

checkInputFormat(waspas_db)

Arguments

waspas_db

The original database to be validated in its format

Value

True if everything is OK, an error message in case of bad format


Data about helicopters

Description

A small database with real helicopter names and criteria that make sense. The values and weights are generated at random. The only requirement for the methods is that their sum be 1. The set of Cost - Benefit flags make no sense in terms of the criteria they refer to and are just a set of strings starting with the letter "C" (cost) or "B" (benefit). That is, a criterion that must be monotonic of benefit want to maximize it) can have a "c" flag, while a criterion that the (we user would rightly judge to be cost (we want to minimize it) can have a "b" flag.

Usage

data(choppers)

Format

An object of class "data.frame"

alternatives

A set of helicopters names that can be bought in the marketplace.These data are in the first column, from row 4 to the last.

criteria

set of criteria that a helicopter buyer may deem relevant for making apurchase decision. These data are in the 3rd row, from col 2 to the last.

weights

Arbitrated by the decision maker, they attribute different relative importance to the values of the criteria in percentage terms, thus making a weighting of these criteria.

flags

They determine whether the specific criterion is cost, that is, the smaller, the better, or benefit, the greater the better. These data are in the 1st row, from col 2 to the last.

values

Randomly generated value, within a range that makes sense These data are in the fourth row, from col 2 to the last.

References

This data set was created with the help of Gustavo, Marcos & Marcio, in the work cited below: Soares de Assis, Gustavo & Santos, Marcos & Basilio, Marcio. (2023). Use of the WASPAS Method to Select Suitable Helicopters for Aerial Activity Carried Out by the Military Police of the State of Rio de Janeiro. Axioms. 12. 77. 10.3390.

Examples

data(choppers)
head(choppers)

normalize()

Description

Normalize the values of Alternatives X Criteria matrix according to a given Cost - Benefit vector of flags.

Usage

normalize(normalized_matrix, vec_cost_benefit)

Arguments

normalized_matrix

A data set object with Alternatives X Criteria values to be normalized

vec_cost_benefit

A vector of flags that determines if the criterion is a Cost or Benefit. Must be same size of Criteria, must contains just strings initiated with B, b, C or c

Value

A data frame object that contains the input matrix values normalized


sliceData

Description

Slice a matrix or data.frame in “all - in - one” format into dedicated vectors/matrices as data.frame objects

Usage

sliceData(waspas_db, output_obj)

Arguments

waspas_db

A matrix or data.frame in “all - in - one” format

output_obj

A flag to determine the vector or matrix (data.frame) to extract from the input matrix must be 'A' (Alternatives), 'C' (Criteria), 'F' (Flags), 'V' (Values) or 'W' (Weights)

Value

A data.frame one - dimensional (vector) or two - dimensional (matrix) with one of the Following objects: - if output_obj == "A": A vector of Alternatives - if output_obj == "C": A vector of Criteria - if output_obj == "F": A vector of Cost - Benefit Flags - if output_obj == "I": A vector containing the indicators in cells [1:3, 1] - if output_obj == "V": A matrix of values per Alternative x Criterion - if output_obj == "W": A vector of Weights


waspasR()

Description

Runs the complete process from slicing the original database, processing all the computational steps, like computing WSM and WPM formulas, applying the lambda as proposed by the method WASPAS, and the building the complete output in a new data.frame with the criteria as column names, all the original data and appending 3 new columns with the WSM, WPM and WASPAS ranking ("WSM_Rank", "WPM_Rank", "WASPAS_Rank").

Usage

waspasR(waspas_df, lambda)

Arguments

waspas_df

The original data set in a proper format. The format can be checked by checkInputFormat() function.

lambda

The lambda value (between 0 and 1)

Value

A data.frame object that contains the input matrix with its values normalized. Or an error message if some bad data is entered.