Open ghost opened 7 years ago
Yes, that's been requested before. I am very open for pull requests!
Hi, The shinny AHP app is a very good tool for solving AHP Problems. It would be also great if we can add sensitivity analysis on the results which can make this package a complete suite for decision making.
Prototyping some ideas here. These manipulate the trees differently from the rest of package code, and they could be nonsense, so it is not contribution-ready.
# Brainstorming some sensitivity charts
library(dplyr)
library(magrittr)
library(tidyr)
library(ggplot2)
library(ahp)
# reuse the car example
ahpFile <- system.file("extdata","car.ahp",package="ahp")
carAhp <- Load(ahpFile)
Calculate(carAhp)
# variant a
# the Hurley method scales the preferences by some coefficient
# priorities obtained from scaled pairwise weights
coefficient_range <- seq(0.1,2.0,0.1)
original <- carAhp$preferences$children$DecisionMaker$pairwiseMatrix$preferences
df <- bind_rows(sapply(coefficient_range, function(j) {
weights <- original ^ j
priorities <- PrioritiesFromPairwiseMatrixEigenvalues(weights)
data.frame(Coefficient=j,t(priorities$priority))
},simplify=FALSE))
# reorganize for plotting
tdf <- df %>% gather(Preference,Weight,-Coefficient)
p <- ggplot(tdf,aes(x=Coefficient,y=Weight,color=Preference)) +
geom_line() +
scale_y_continuous(limits=c(0,1)) +
geom_vline(xintercept=1.0,linetype="dashed") +
labs(title = "Priorities from Pairwise Matrix Eigenvalues",
caption = "Hurley-method sensitivity analysis",
x=expression(paste("Coefficient ",alpha)))
p
# variant b
# manipulating the decision-maker preferences
# scaled coefficient range reused
# not strictly a Hurley variant because it can result in rank reversal
# reload the model
carAhp <- Load(ahpFile)
Calculate(carAhp)
original <- carAhp$preferences$DecisionMaker$pairwise$preferences$preference
df <- bind_rows(sapply(coefficient_range, function(j) {
scaled <- original ^ j
carAhp$preferences$DecisionMaker$pairwise$preferences$preference <- scaled
Calculate(carAhp)
adf <- Analyze(carAhp,decisionMaker="Total",variable="weightContribution",sort="orig")
adf %<>% select(-1,-Weight)
if ( "Inconsistency" %in% colnames((adf)))
adf %<>% select(-Inconsistency)
data.frame(Coefficient=j,adf[1,])
},simplify=FALSE))
# reorganize for plotting
tdf <- df %>% gather(Priority,Weight,-Coefficient)
p <- ggplot(tdf,aes(x=Coefficient,y=Weight,color=Priority)) +
geom_line() +
geom_vline(xintercept=1.0,linetype="dashed") +
labs(title = "Priority by Scaled Pairwise Preferences",
y="Weight Contribution",
x=expression(paste("Coefficient ",alpha)))
p
Hello,
Is there any development on sensitivity to this package? I would like to see if there is any.
Thanks
Enhancement request: Is there any interest in adding one or more methods for performing sensitivity analysis on the results? The paper A Sensitivity Analysis Approach for Some Deterministic Multi-Criteria Decision Making Methods, for example, presents a few techniques.