Learn R Programming

ahp (version 0.2.4)

Analyze: Analyze your AHP model

Description

Converts the calculated AHP tree into a data.frame or an HTML table, containing all the weight contributions or priorities to/of the overall decision. You can also sort and filter the output.

Displays the AHP analysis in form of an html table, with gradient colors and nicely formatted.

Usage

Analyze(ahpTree, decisionMaker = "Total", variable = c("weightContribution",
  "priority", "score"), sort = c("priority", "totalPriority", "orig"),
  pruneFun = function(node, decisionMaker) TRUE)

AnalyzeTable(ahpTree, decisionMaker = "Total", variable = c("weightContribution", "priority", "score"), sort = c("priority", "totalPriority", "orig"), pruneFun = function(node, decisionMaker) TRUE, weightColor = "honeydew3", consistencyColor = "wheat2", alternativeColor = "thistle4")

PruneByCutoff(node, decisionMaker, minWeight = 0)

PruneLevels(node, decisionMaker, levelsToPrune = 0)

Arguments

ahpTree
the calculated AHP data.tree
decisionMaker
the name of the decision maker. The default returns the joint decision.
variable
the variable to display, i.e. either weightContribution (the default), priority, or score
sort
sort either by priority according to the decision maker (the default), by totalPriority, or as originally specified (orig)
pruneFun
use this to filter the what rows are shown in the analysis pruneFun must be a function taking a Node as its first argument, and the decisionMaker as its second argument. The default (NULL) returns the fu
weightColor
The name of the color to be used to emphasize weights of categories. See color for a list of possible colors.
consistencyColor
The name of the color to be used to highlight bad consistency
alternativeColor
The name of the color used to highlight big contributors to alternative choices.
node
the Node
minWeight
prunes the nodes whose weightContribution is smaller than the minWeight
levelsToPrune
cuts the n hightest levels of the ahp tree

Value

  • Analyze returns a data.frame containing the contribution of each criteria

    AnalyzeTable returns a formattable data.frame object which, in most environments, will be displayed as an HTML table

    the Prune methods must return TRUE for nodes to be kept, FALSE for nodes to be pruned

Examples

Run this code
ahpFile <- system.file("extdata", "car.ahp", package="ahp")
carAhp <- Load(ahpFile)
Calculate(carAhp)
Analyze(
   carAhp,
   pruneFun = function(x, decisionMaker) {
     PruneLevels(x, decisionMaker, 1) && PruneByCutoff(x, decisionMaker, minWeight = 0.05)
   }
)


ahpFile <- system.file("extdata", "vacation.ahp", package="ahp")
vacationAhp <- Load(ahpFile)
Calculate(vacationAhp)
AnalyzeTable(
   vacationAhp,
   decisionMaker = "Kid",
   variable = "score",
   sort = "totalPriority"
)

Run the code above in your browser using DataLab