ahp {ahpsurvey}R Documentation

Canned routine for AHP

Description

ahp is a canned routine that returns a data.frame of individuals' priorities (based on ahp.indpref), number of missing values, consistency ratios, and top three pairs of inconsistent pairwise comparisons. An optional argument agg allows the user to generate a data.frame of aggregated priorities alongside individual priorities.

Usage

ahp(
  df,
  atts,
  negconvert = FALSE,
  reciprocal = TRUE,
  method = "eigen",
  aggmethod = "geometric",
  qt = 0,
  censorcr = Inf,
  agg = FALSE,
  ID = NULL,
  col = NULL,
  suppress = "none"
)

Arguments

df

a dataframe, each row corresponding to one decision-maker, with columns ordered according to atts.

atts

a list of attributes in the correct order

negconvert

logical, whether to convert all positive values to negative. In the pairwise comparison A_B, if -6 denotes A is more important than B by 6 units, set negconvert = TRUE.

reciprocal

logical, whether to convert negative values (after negconvert) to its reciprocal. If the comparison A_B where B is more important than A was already entered in its reciprocal (e.g. 1/6), choose reciprocal = FALSE. When reciprocal = FALSE, do not set negconvert = TRUE.

method

if method = "eigen", the individual priority weights are computed using the Dominant Eigenvalues method described in Saaty (2003). Otherwise, then the priorities are computed based on the averages of normalized values. Basically it normalizes the matrices so that all of the columns add up to 1, and then computes the averages of the row as the priority weights of each attribute. Three modes of finding the averages are available: arithmetic: the arithmetic mean; geometric: the geometric mean (the default); rootmean: the square root of the sum of the squared value.

aggmethod

how to aggregate the individual priorities. By default aggmethod = method. Apart from the methods offered in method, aggmethod also permits three other options: tmean computes the trimmed arithmetic mean, tgmean computes the trimmed geometric mean (both with quantiles trimmed based on qt), and sd computes the standard deviation from the arithmetic mean. If method = "eigen" and aggmethod is not specified, aggmethod defaults to "geometric".

qt

specifies the quantile which the top and bottom priority weights are trimmed. Used only if aggmethod = 'tmean' or aggmethod = 'tgmean'. For example, qt = 0.25 specifies that the aggregation is the arithmetic mean of the values from the 25 to 75 percentile. By default qt = 0.

censorcr

the threshold of censoring observations. All observations with a consistency ratio higher than the specified CR will be dropped from the routine. By default, censorcr = Inf, i.e. drops no observations.

agg

by default, agg = FALSE, which suppresses the output of Aggregated priorities. If agg = TRUE, the output will be a list where ⁠$AggPref⁠ contains the Aggregated priorities and Standard Deviations.

ID

the column name, or a vector of column names, of variables in df, which are used to indicate specific observations. For example, if a survey dataset comes with an identifier/ multiple identified for each observation, use this so that the output dataframe would contain this identifier.

col

a list of column names which contains the columns for the pairwise comparison matrix in chronological order, as specified in atts. For example, if atts is c("A","B","C"), then col would be c("A_B","A_C","B_C"), with "A_B" being a pairwise comparison of attribute A and B. col = NULL by default, indicating that the dataframe specified already contained the pairwise comparisons in correct order and nothing else except of what is inside ID.

suppress

Suppresses the supplementary indices. Can take the values of "all" (suppresses all indices), "pwerror" (suppresses pwerror), or "cr" (suppresses consistency ratio).

Value

If agg = TRUE, returns a list of the results with two elements, indpref and aggpref. ⁠$indpref⁠ contains individual preference weight (same as ahp.indpref), consistency ratios, and the top three most inconsistent pairwise comparisons (same as ahp.pwerror). ⁠$aggpref⁠ contains the Aggregated Priorities and Standard Deviations. Otherwise (i.e. default setting), outputs a data.frame with only ⁠$indpref⁠.

Author(s)

Frankie Cho

References

Saaty TL (2004). “Decision making — the Analytic Hierarchy and Network Processes (AHP/ANP).” Journal of Systems Science and Systems Engineering, 13(1), 1–35. ISSN 1861-9576, doi: 10.1007/s11518-006-0151-5, https://doi.org/10.1007/s11518-006-0151-5.

Examples


data(city200)
ahp(df = city200, atts = c('cult', 'fam', 'house', 'jobs', 'trans'), negconvert = TRUE)


[Package ahpsurvey version 0.4.1 Index]