R ahp package on github

AHP lets you analyse complex decision making problems. We have recently released the initial version of the R ahp package on github: gluc/ahp.

What is AHP?

The Analytic Hierarchy Process is a decision making framework developed by Thomas Saaty. Read this entry on Wikipedia for more information.

There is commercial software available to use this methodology for complex decision making problems. In R, there are a few packages that help with the calculation part. However, there has not been a framework to model entire AHP problems. This is the goal of the ahp package.

How to get started

For more information, see the package vignette, either using vignette("car-example"), or on rpubs. That vignette models the well-known AHP example, which is, for example, explained here.

To install the package and read the vignette, you want to do this:

Modeling Analytic Hierarchy Process problems

Once the package is installed, you can run the sample yourself, like so:

This illustrates the basic workflow, which is:

The basic workflow with this package is:

  1. specify your ahp problem in an ahp file
  2. load an ahp file, using LoadFile
  3. calculate model, using Calculate
  4. output model analysis, either using GetDataFrame or using ShowTable

ahp File Format

The entire ahp problem is specified in a single file, in YAML format. For an example, see here.

Analysis

GetDataFrame

There are two options for the analysis. The first one prints to the console:

What you will see is something like this:

The Odyssey comes out first, but only slightly better than the Accord Sedan.

ShowTable

The ShowTable method displays the same analysis as an html table, using color codes:

AHP ShowTable

Here, it’s easy to see that the Odyssey is more expensive then the Accord Sedan, however Safety and Passenger Capacity make more than up for this.

Also note the exclamation mark at the Style Consistency: A consistency ratio of above 10% is considered inconsistent, and we might want to review the style preferences in the ahp file.

As a side note: This table is generated with the fantastic formattable package.

Feedback and Future Developments

This is an early version, and thus feedback is more than welcome. You can ask questions and open issues directly on github issues page. Also, I appreciate if you star the package on github if you like.

The plan is to add a few test cases, error handling, and submit it to CRAN. A future development I am currently considering is to add a simple Shiny app to the package, letting you specify and tweak your file directly in your web browser, and showing the analysis also in your Browser.

For your information, there is now an app that lets you play around with the package at http://ipub.com/apps/ahp/

8 thoughts on “R ahp package on github”

Leave a Reply