Sensitivity analysis using hexbin plot
The simulation results you generated in the previous exercise are saved in the DataFrame df_sa
which has been loaded for you.
Recall that df_sa
has three columns: Inflation
contains the mean inflation rates used in the simulations, Volume
contains the mean sales volumes used in the simulations, and Profit
contains forecasted profits based on your simulation.
You'll now use a hexbin
plot to perform sensitivity analysis and understand the impact of these parameters!
The following libraries have been imported for you: pandas
as pd
, numpy
as np
, scipy.stats
as st
, and matplotlib.pyplot
as plt
.
This exercise is part of the course
Monte Carlo Simulations in Python
Exercise instructions
- Complete the hexbin plot code to visualize the sensitivity analysis results; use
Inflation
as the x-axis,Volume
as the y-axis, and the mean values ofProfits
as the basis for the color of the hexbins.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Complete the hexbin to visualize sensitivity analysis results
____(x=____,
y=____,
C=____,
reduce_C_function=____,
gridsize=10,
cmap="viridis",
sharex=False)
plt.show()