Skip to main content

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

Project description

Relative Importance Calculator


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.


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


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.  


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

df = pd.read_excel("raw_survey_responses.xlsx")
yName = 'Overall Satisfaction'
xNames = ['Response Time to the Service Call',
            'Efficiency of Handling the Service Call',
            'Answer/Solution Provided',
            'Knowledge of the Service Personnel',
            'Communication Skills of the Service Personnel',
            'Professionalism of the Service Personnel']

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


Copyright © 2019 Dan Yang

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for relativeImp, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size relativeImp-0.0.2-py3-none-any.whl (4.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size relativeImp-0.0.2.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page