Analyze sales compensation payout sensitivity using python (Jupyter) - Incentius Blog Home - Incentius - Enable Digital Transformation  

[![Logo](/img_astro/incentius-logo.svg)](/)

Solutions

About

[Case Studies](/portfolio/)

[Blogs](/blog-posts/)

[Career](http://aurochs.freshteam.com/jobs)

Open main menu ![Menu icon](/img_astro/menu1.png)  

[Get In Touch](/contact/)

Solutions

 [![](/img_astro/generative-black.svg) ![](/img_astro/brain-green.svg)

Voice AI](/voice-ai/)

 [![](/img_astro/product-development-black.svg) ![](/img_astro/product-development.svg)

Product Development](/product-engineering/)

 [![](/img_astro/generative-black.svg) ![](/img_astro/brain-green.svg)

Generative AI](/generative-ai/)

 [![](/img_astro/data-black.svg) ![](/img_astro/database-green.svg)

Data Engineering](/data-engineering/)

 [![](/img_astro/mvp-black.svg) ![](/img_astro/rocket-green.svg)

Data & Analytics](/data-analytics/)

 [![](/img_astro/cloud-black.svg) ![](/img_astro/computing-green.svg)

DevOps & CloudOps](/devops-and-cloudops/)

About Us

  [![](/img_astro/product-black.svg)  ![](/img_astro/product-green.svg)

About Us](/about-us/)

  [![](/img_astro/team_black.svg)  ![](/img_astro/team_green.svg)

Team](/team/)

Solutions ![](/img_astro/dropdown-arr.svg) 

[

![](/img_astro/generative-black.svg)

Voice AI



](/voice-ai/)[

![](/img_astro/product-development-black.svg)

Product Development



](/product-engineering/)[

![](/img_astro/generative-black.svg)

Generative AI



](/generative-ai/)[

![](/img_astro/data-black.svg)

Data Engineering



](/data-engineering/)[

![](/img_astro/mvp-black.svg)

Data & Analytics



](/data-analytics/)[

![](/img_astro/cloud-black.svg)

DevOps & CloudOps



](/devops-and-cloudops/)

[Blogs](/blog-posts/) About ![](/img_astro/dropdown-arr.svg) 

[

![](/img_astro/product-black.svg)

About Us



](/about-us/)[

![](/img_astro/team_black.svg)

Team



](/team/)

[Case Studies](/portfolio/) [Career](http://aurochs.freshteam.com/jobs)

[Get In Touch](/contact/)

Analyze sales compensation payout sensitivity using python (Jupyter)

Sujeet Pillai

1.  Jun 20, 2014
2.  4 min read

![](/_astro/juypter-blog-scaled.width-1000_zSfKL.webp)

## Introduction

A critical component of sales compensation plan design is testing the plan against various scenarios of the sales performance of individual salespeople. Typically a newly designed sales compensation plan is tested against historical sales performance to gauge how the new compensation plan would payout if it had been implemented in the previous plan period. While using historical performance can help, it's also important to test it against a randomized sales performance set to check the sensitivity of your payouts to sales variations. When your sales compensation plan rolls out, it typically affects sales rep behavior, and we must ensure that such changes don't result in any budgetary surprises. This is also a good analysis to run on a periodic basis to estimate the risk to your sales compensation budgets from any unforeseen market events.

## Python and IPython

Such sensitivity analysis requires a large number of repeated sales compensation calculations and an ability to quickly introduce randomness, variation, etc., to generate data scenarios. Traditionally Excel has been used for similar analyses. However, with the volume of calculations and looping constraints, the entire process becomes very cumbersome. [Python](http://www.python.org) with the [numpy](http://www.numpy.org) library is perfect for such data manipulation. [Matplotlib](http://matplotlib.org/) is the visualization tool of choice to be used in combination with IPython.

[IPython](http://www.ipython.org) is a powerful interactive python shell with support for rich data visualization. Specifically, the IPython [notebook](http://ipython.org/notebook.html) is a browser-based IPython shell with support for in-browser data visualizations and embedding rich media. We will use the IPython notebook for this analysis to take advantage of the in-browser visualizations that are offered.

[Here](http://ipython.org/install.html) is some help on how to set up IPython on your computer to try out.

# IPython setup

First, let's set up IPython for the needs of our analysis.

\# start IPython notebook IPython notebook

This should open up a list of notebooks in the current working directory. Create a new notebook by clicking "New Notebook".

Let's use IPython magic commands to set up our IPython environment such that all graphs are plotted in the browser.

#Use in browser graphs %matplotlib inline

Also, let's import all the python libraries we'll be using for this exercise.

import numpy import matplotlib import CompUtils

## The Plan

Let's assume that the compensation plan setup is a [payout curve](https://www.aurochssolutions.com/blog/different-types-of-sales-incentive-payout-curves-explained/) of revenue achievement to a payout percentage. The related table is given below:

Revenue AchievementPayout Percentage 0%0% 50%35% 80%75% 100%100% 120%150% 300%500%

![](https://incentius.com/wp-content/uploads/2014/06/compensation-curve.png)

The points in between consecutive revenue achievement points are interpolated linearly between the payout percentages.

Let's initialize the plan in our IPython notebook

\# Initialize Rate Table payout\_table = CompUtils.Rate\_Table() payout\_table.add\_row(0,0) payout\_table.add\_row(0.5,0.35) payout\_table.add\_row(0.8,0.75) payout\_table.add\_row(1.0,1.0) payout\_table.add\_row(1.2,1.5) payout\_table.add\_row(3.0,5.0)

## Inputs

Next, let's set up some salesforce attributes. Let's assume that the salesforce has 1000 sales reps, each with a Target Incentive of $5,000 per month. Let's also assume that their revenue goal is $10,000 per month.

number\_of\_reps = 1000 target\_incentive = 5000 revenue\_goal = 10000

Now we're ready to set up the simulation. For revenue, we're going to assume that these 1000 sales reps perform at a mean sales revenue of $11,000 with a $4,000 standard deviation.

mean\_sales\_revenue\_of\_population = 11000 std\_dev\_sales\_revenue = 4000

## Simulation

The next step is to run the actual simulation. We'll set it up so that these steps are followed: - the sales revenue for 1000 reps will be randomized around the mean and standard deviation, - their achievement of goal will be calculated - their payout % looked up on the curve - their final payout calculated as the product of payout % and target incentive.

sales\_revenue = numpy.random.normal(mean\_sales\_revenue\_of\_population,std\_dev\_sales\_revenue, number\_of\_reps) # Randomized set of sales revenue revenue\_achievement = sales\_revenue/revenue\_goal # Revenue achievement set of population payout\_pct = CompUtils.calculate\_lookup\_attainment(revenue\_achievement,payout\_table.rows) rep\_payout = payout\_pct \* target\_incentive total\_salesforce\_payout = numpy.sum(rep\_payout) print 'Total Salesforce Payout = %d' % total\_salesforce\_payout

This would print something like:

Total Salesforce Payout = 6675583

Ok, so we've run the simulation using a random set of sales revenue inputs and calculated the total salesforce payout. However, that Total salesforce payout number would keep changing as the random sales revenue input set changes. Hence let's run this simulation repeatedly, say 100 times, and then summarize the results from those 100 runs. How do we do that? Let's refactor the above code as follows:

iterations\_array = for i in range(100): # Randomized set of sales revenue sales\_revenue = numpy.random.normal(mean\_sales\_revenue\_of\_population,std\_dev\_sales\_revenue,number\_of\_reps) revenue\_achievement = sales\_revenue/revenue\_goal # Revenue achievement set of population payout\_pct = CompUtils.calculate\_lookup\_attainment(revenue\_achievement,payout\_table.rows) rep\_payout = payout\_pct \* target\_incentive total\_salesforce\_payout = numpy.sum(rep\_payout) iterations\_array.append(total\_salesforce\_payout)

That was easy. Basically, we created an array to store the result from each iteration and pushed the total\_salesforce\_payout into that array. Let's now visualize the results and derive some useful statistics out of these iterations:

matplotlib.pyplot.hist(iterations\_array,bins=20,color='green') print 'Mean Total Salesforce Payout = %d' % numpy.mean(iterations\_array) print 'Median Total Salesforce Payout = %d' % numpy.median(iterations\_array) print 'Standard Deviation Total Salesforce Payout = %d' % numpy.std(iterations\_array) print 'Max Total Salesforce Payout = %d' % numpy.max(iterations\_array) print 'Min Total Salesforce Payout = %d' % numpy.min(iterations\_array)

This should produce an output as follows:

![](https://incentius.com/wp-content/uploads/2014/06/bar-graph.png)

Mean Total Salesforce Payout = 6657248 Median Total Salesforce Payout = 6645881 Standard Deviation Total Salesforce Payout = 117827 Max Total Salesforce Payout = 6963018 Min Total Salesforce Payout = 6385194

Excellent, so for that run, we've identified the range of possible payouts, the mean, the median, and the deviation potential of the total salesforce payouts. The distribution graph shows where the total payouts of the 100 iterations we performed landed.

## Sensitivity

Our simulation now shows the variation possible in the payouts as a result of random sales revenue performance inputs. We can tweak this simulation by increasing the standard deviation on the sales revenue inputs to analyze the effect on the total payout. Similarly, we can also gauge the change in the total payout with a variation in the mean of the sales revenue randomized input. That will display our plan payout's sensitivity to variations in sales performance.

Let's refactor our code to introduce a sales increase factor and then run our simulation again. We'll basically multiply the mean of the sales revenue input by this factor before calculating the randomized input. Effectively we're going to test the sensitivity of plan payout to 2%, 5%, 7%, 12%, 15%, 18%, 20%, and 25% increases in mean sales.

results\_array = sales\_increase\_factor\_list = for sales\_increase\_factor in sales\_increase\_factor\_list: iterations\_array = for i in range(100): # Randomized set of sales revenue sales\_revenue = numpy.random.normal(mean\_sales\_revenue\_of\_population\*(1+sales\_increase\_factor),std\_dev\_sales\_revenue,number\_of\_reps) revenue\_achievement = sales\_revenue/revenue\_goal # Revenue achievement set of population payout\_pct = CompUtils.calculate\_lookup\_attainment(revenue\_achievement,payout\_table.rows) rep\_payout = payout\_pct \* target\_incentive total\_salesforce\_payout = numpy.sum(rep\_payout) iterations\_array.append(total\_salesforce\_payout) results\_array.append(dict(sales\_increase\_factor=sales\_increase\_factor, mean=numpy.mean(iterations\_array), median=numpy.median(iterations\_array), std=numpy.std(iterations\_array), max=numpy.max(iterations\_array), min=numpy.min(iterations\_array)))

Ok, so we've run the simulation for each value in the sales increases factor list. Now let's plot and display our results.

\# Set up matplotlib options matplotlib.pyplot.figure(figsize=(9,6)) font = {'family' : 'Arial', 'weight' : 'normal', 'size' : 14} matplotlib.rc('font', \*\*font) # Plot lines matplotlib.pyplot.plot(map(lambda x:x,results\_array), map(lambda x:x,results\_array),label='mean',lw=2) matplotlib.pyplot.plot(map(lambda x:x,results\_array), map(lambda x:x,results\_array),label='min',ls='-.') matplotlib.pyplot.plot(map(lambda x:x,results\_array), map(lambda x:x,results\_array),label='max',ls='-.') # Set up plot options matplotlib.pyplot.legend(loc=3) # matplotlib.pyplot.axis(ymin=0) matplotlib.pyplot.ticklabel\_format(style='sci', axis='y', scilimits=(0,999999999)) matplotlib.pyplot.xlabel('Sales Increase Factor') matplotlib.pyplot.ylabel('Total Salesforce Payout') # Display in table form from IPython.display import HTML html='''<table> <thead> <th>Sales Increase Factor</th> <th>Mean Total Payout</th> <th>Max Total Payout</th> <th>Min Total Payout</th> <th>Increase in Payout</th> </thead> ''' formatted\_numbers = map(lambda x:),'${:,.0f}'.format(x),'${:,.0f}'.format(x),'${:,.0f}'.format(x),'{:.0%}'.format((x/results\_array)-1)\],results\_array) # print formatted\_numbers html = html+(''.join(map(lambda x: '<tr><td>'+('</td><td style="text-align:right">'.join(x))+'</td></tr>',formatted\_numbers)))+'</table>' HTML(html)

This should generate an output that looks like this:

Sales Increase FactorMean Total PayoutMax Total PayoutMin Total PayoutIncrease in Payout 0%$6,661,012$6,936,747$6,355,4510%2%$6,855,002$7,128,312$6,661,2553%5%$7,123,175$7,344,958$6,799,0927%7%$7,346,115$7,599,005$7,072,25810%12%$7,859,148$8,091,215$7,560,60418%15%$8,161,052$8,491,135$7,831,55323%18%$8,461,816$8,754,745$8,233,40027%20%$8,657,557$8,924,484$8,347,14030%25%$9,188,707$9,437,714$8,940,52938%

![](https://incentius.com/wp-content/uploads/2014/06/sales-increase-factor.png)

Let's look at the results. It shows that at an $11k sales revenue mean with a $4k standard deviation, your comp plan is likely to pay a mean payout of about $6.6M with a max of $6.9M and a min of $6.3M. As your sales performance improves this number obviously goes up. For a 12% increase in sales, your plan is expected to pay about $7.85M on average (max of $8.09M and min of $7.56M).

> That represents an 18% increase in payout for a 12% increase in sales performance. That is the estimate of your compensation plan's sensitivity.

Our sensitivity scenarios were quite straightforward. We basically multiplied by a straight factor to improve your sales performance. However, these scenarios can be as complex as the questions you'd like to ask of the data. For Example:

> What if in response to my new compensation plan, the top 20% of my salesforce did not change their performance however the next quintile improved their sales performance by 10% and the third quintile by 35%. What would the effect on my total payout?

Such questions are easy to analyze once you have a basic sensitivity model as we have set up. The advantage of using python in such a case is it's easy to swap scenario types without much rework.

You can download all the codes [here](https://github.com/sujeetpillai/sensitivity_of_payout)

To learn more about Incentius capabilities, visit our [data analytics](/data-analytics/) page

Do you need additional help with sales compensation plan design/testing for your company? Please email us at info@incentius.com

And if you got this far, we think you’d like our future blog content, too. Please subscribe on the right side.

About Author

![](/_astro/Sujeet_Pillai.width-300_2fQenu.webp)

Sujeet Pillai

![](/img_astro/thumb.png)

As an experienced polymath, I seamlessly blend my understanding of business, technology, and science.

### See What Our Clients Say

![](/img_astro/left-chevron_1.svg)

![](/img_astro/left-chevron_2.svg)

![](/img_astro/mind-gap-crop.svg)

Mindgap

Incentius has been a fantastic partner for us. Their strong expertise in technology helped deliver some complex solutions for our customers within challenging timelines. Specific call out to Sujeet and his team who developed custom sales analytics dashboards in SFDC for a SoCal based healthcare diagnostics client of ours. Their professionalism, expertise, and flexibility to adjust to client needs were greatly appreciated. MindGap is excited to continue to work with Incentius and add value to our customers.

Samik Banerjee

Founder & CEO

![](/img_astro/trusted-by-businesses/worldatwork_coloured.webp)

World at Work

Having worked so closely for half a year on our website project, I wanted to thank Incentius for all your fantastic work and efforts that helped us deliver a truly valuable experience to our WorldatWork members. I am in awe of the skills, passion, patience, and above all, the ownership that you brought to this project every day! I do not say this lightly, but we would not have been able to deliver a flawless product, but for you. I am sure you'll help many organizations and projects as your skills and professionalism are truly amazing.

Shantanu Bayaskar

Senior Project Manager

![](/img_astro/trusted-by-businesses/gogla_coloured.webp)

Gogla

It was a pleasure working with Incentius to build a data collection platform for the off-grid solar sector in India. It is rare to find a team with a combination of good understanding of business as well as great technological know-how. Incentius team has this perfect combination, especially their technical expertise is much appreciated. We had a fantastic time working with their expert team, especially with Amit.

Viraj gada

Gogla

![](/img_astro/trusted-by-businesses/humblex_coloured.webp)

Humblx

Choosing Incentius to work with is one of the decisions we are extremely happy with. It's been a pleasure working with their team. They have been tremendously helpful and efficient through the intense development cycle that we went through recently. The team at Incentius is truly agile and open to a discussion in regards to making tweaks and adding features that may add value to the overall solution. We found them willing to go the extra mile for us and it felt like working with someone who rooted for us to win.

Samir Dayal Singh

CEO Humblx

![](/img_astro/mind-gap-crop.svg)

Transportation & Logistics Consulting Organization

Incentius is very flexible and accommodating to our specific needs as an organization. In a world where approaches and strategies are constantly changing, it is invaluable to have an outsourcer who is able to adjust quickly to shifts in the business environment.

Transportation & Logistics Consulting Organization

Consultant

![](</img_astro/trusted-by-businesses/Mudraksh & McShaw.png>)

Mudraksh & McShaw

Incentius was instrumental in bringing the visualization aspect into our investment and trading business. They helped us organize our trading algorithms processing framework, review our backtests and analyze results in an efficient, visual manner.

Priyank Dutt Dwivedi

Mudraksh & McShaw Advisory

![](/img_astro/mind-gap-crop.svg)

Leading Healthcare Consulting Organization

The Incentius resource was highly motivated and developed a complex forecasting model with minimal supervision. He was thorough with quality checks and kept on top of multiple changes.

Leading Healthcare Consulting Organization

Sr. Principal

![](/img_astro/mind-gap-crop.svg)

US Fortune 100 Telecommunications Company

The Incentius resource was highly motivated and developed a complex forecasting model with minimal supervision. He was thorough with quality checks and kept on top of multiple changes.

Incentive Compensation

Sr. Director

Most Read

[

![](/_astro/ChatGPT_Image_Apr_2_2025_12_06_35_PM.width-1000_ZUChn3.webp)

Optimizing Large-Scale Data Exports: FastAPI, GraphQL, and AWS S3

Struggling with slow, inefficient file downloads in your application? Generating and handling large file downloads can be a nightmare—UI freezing, server overload, and endless waiting.

![](/_astro/Vinay_Chaudhari.width-300_1QPJnB.webp)

Vinay Chaudhari

1.  Apr 08, 2025
2.  4 min read









](/blog-posts/optimizing-large-scale-data-exports-fastapi-graphql-and-aws-s3/)[

![](/_astro/Screenshot_2025-04-02_at_12.09.33_PM.width-1000_ZyU6y1.webp)

How to Build a Web Search Agent with Phidata: A Step-by-Step Guide

Phidata is an **open-source framework** for building AI agents with capabilities like memory, tool use, and reasoning​ It’s model-agnostic and supports various large language models (LLMs), allowing developers to turn any LLM (like OpenAI GPT or local models) into a functional **search agent**.

![](/_astro/Kartik_Puri.width-300_1YNCyp.webp)

Kartik Puri

1.  Apr 02, 2025
2.  4 min read









](/blog-posts/how-to-build-a-web-search-agent-with-phidata-a-step-by-step-guide/)[

![](/_astro/e20f5335-cbf6-414c-a096-7d2849109cff.width-1000_15DfBS.webp)

Migrating to Soketi: Improving Our Real- Time Communication Architecture

Our journey with real-time data communication has evolved significantly. Initially using

Flask-SocketIO with Vue, we faced several challenges that led us to seek a more robust

solution.

![](/_astro/pratik.width-300_Z2vB9eu.webp)

Pratik Patel

1.  Mar 17, 2025
2.  4 min read









](/blog-posts/migrating-to-soketi-improving-our-real-time-communication-architecture/)[

![](/_astro/startup-employee-looking-business-charts-usin.width-1000_2knrAp.webp)

Understanding AI Agents: A Comprehensive Guide to AI Agentic Workflows

In the rapidly evolving landscape of artificial intelligence, AI Agents have emerged as a transformative technology that represents far more than just industry jargon.

![](/_astro/chetan_piucv.width-300_ZK3Vor.webp)

Chetan Patel

1.  Feb 28, 2025
2.  4 min read









](/blog-posts/understanding-ai-agents-a-comprehensive-guide-to-ai-agentic-workflows/)

## We use cookies

We use cookies to improve site. Some cookies are necessary for our website and services to function properly. Other cookies are optional and help personalize your experience, including advertising and analytics.You can consent to all cookies or decline all optional cookies. Without a selection, our default cookie settings will apply.

I agree I decline

[![logo](/img_astro/logo.svg)](/)

Incentius is a technology and professional services company providing analytics, operations and product engineering services.

 [![facebook](/img_astro/facebook.svg)](https://www.facebook.com/Incentius/)[![twitter](/img_astro/twitter.svg) ](https://x.com/incentius/)[![linkedin](/img_astro/linkedin.svg)](https://www.linkedin.com/company/incentius/posts/?feedView=all)

![location](/img_astro/pin.svg)

Office No.201B, 2nd Floor, Beta-1, Giga Space IT Park, Viman Nagar, Pune - 411014, Maharashtra, India

![email](/img_astro/message-icon.svg)

info@incentius.com

![phone](/img_astro/telephone.svg)

+1 (302) 415 3208

![](/img_astro/secure-footer.svg) ![](/img_astro/secure-footer-mobile.svg)

*   Solutions
*   [Voice AI](/voice-ai/)
*   [Generative AI](/generative-ai/)
*   [Data Engineering](/data-engineering/)
*   [Product Development](/product-engineering/)
*   [Data & Analytics](/data-analytics/)
*   [DevOps & CloudOps](/devops-and-cloudops/)
*   [UI/UX Design](/ui-ux-design/)

*   Recent Blog
*   [Medallion Architecture in Practice: Six Layers, One Source of Truth](/blog-posts/medallion-architecture-in-practice-six-layers-one-source-of-truth/)
*   ["Document later" is how teams say "document never"](/blog-posts/document-later-is-how-teams-say-document-never/)
*   [Your Business & AI - What It Actually Means for You](/blog-posts/your-business-ai-what-it-actually-means-for-you/)
*   [How Internal Agent-Built Software Reduced Our SaaS Dependency](/blog-posts/how-internal-agent-built-software-reduced-our-saas-dependency/)
*   [MarkItDown: A Powerful Utility for File Conversion to Markdown](/blog-posts/markitdown-a-powerful-utility-for-file-conversion-to-markdown/)
*   [Python 3.14: A Game-Changing Release for Modern Development](/blog-posts/python-314-a-game-changing-release-for-modern-development/)
*   [Building a RESTful Blog API with Flask and Swagger: A Complete Guide to Streamlined API Development](/blog-posts/building-a-restful-blog-api-with-flask-and-swagger-a-complete-guide-to-streamlined-api-development/)
*   [Tailwind CSS 4.0 vs 3.x: What Changed and How We Implemented It](/blog-posts/tailwind-css-40-vs-3x-what-changed-and-how-we-implemented-it/)
*   [The Future of AI: What to Expect in the Next 5 Years](/blog-posts/the-future-of-ai-what-to-expect-in-the-next-5-years/)

*   Menu
*   [About](/about-us/)
*   [Blog](/blog-posts/)
*   [Career](http://aurochs.freshteam.com/jobs)
*   [Case Studies](/portfolio/)
*   [For Startups](/startups/)
*   [Let's Talk](/contact/)

© Copyright 2025 Incentius

[Request Site](/)  
  
[Terms and Conditions](/)  
  
[Privacy Policy](/privacy-policy/)