Giter Site home page Giter Site logo

Sensitivity analysis about ahp HOT 4 OPEN

gluc avatar gluc commented on August 19, 2024
Sensitivity analysis

from ahp.

Comments (4)

gluc avatar gluc commented on August 19, 2024

Yes, that's been requested before. I am very open for pull requests!

from ahp.

ravikiranrv avatar ravikiranrv commented on August 19, 2024

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.

from ahp.

 avatar commented on August 19, 2024

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

ppme

pspp

from ahp.

juntianusj avatar juntianusj commented on August 19, 2024

Hello,

Is there any development on sensitivity to this package? I would like to see if there is any.

Thanks

from ahp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.