relativeImp is a Python package to conduct the key driver analysis and generate relative importance by driver.

# Relative Importance Calculator

## Introduction

Key driver analysis is a popular and powerful tool in marketing research to quantify the relative importance of individual drivers in predicting an outcome variable. For example, marketing researchers conduct key driver analysis using customer experience survey responses to understand which aspects of the customer experience would drive the customer overall satisfaction the most.

As drivers are often highly correlated with each other, typical multiple regression analysis would produce flawed indicators of driver importance. Instead, we adopt the relative weight analysis approach which accurately partitions variance among the correlated drivers.

The Relative Importance Calculator produces the raw and normalized relative importance by driver for a specified outcome variable. The sum of the raw relative importance equals R-squared (i.e. the total proportion of variation in the outcome variable that can be explained by all the drivers) and the sum of the normalized relative importance equals one.

## Prerequisite

To use the Relative Importance Calculator, you need to have pandas and NumPy installed.

## Installation

Install the Relative Importance Calculator from PyPI:

`pip install relativeImp`

## Input and Output

The Relative Importance Calculator takes three mandatory input parameters and returns a pandas DataFrame:

Input Parameters:

``````df: pandas.core.frame.DataFrame
Raw input data, e.g. survey responses

outcomeName: str
Name of the single outcome variable, e.g. overall satisfaction scores

driverNames: list
Names of the driver variables, e.g. satisfication drivers such as quality, ease of use etc.
``````

Output:

``````pandas.core.frame.DataFrame with three columns:
driver: names of the driver variables
rawRelaImpt: the raw relative importance whose sum equals R-squared
normRelaImpt: the normalized relative importance whose sum equals one
``````

## Example Code

```import pandas as pd
from relativeImp import relativeImp

yName = 'Overall Satisfaction'
xNames = ['Response Time to the Service Call',
'Efficiency of Handling the Service Call',
'Knowledge of the Service Personnel',
'Communication Skills of the Service Personnel',
'Professionalism of the Service Personnel']

df_results = relativeImp(df, outcomeName = yName, driverNames = xNames)
```

## Project details

This version 0.0.2 0.0.1