# Monte Carlo Simulation

Revenue, COGS, Gross Profit simulation for business-planning

Last updated: May 25th, 2020

Import libraries necessary to work with

In [1]:
import numpy as np
from plotly import graph_objects as go
init_notebook_mode(connected=True)


Estimate our variables

In [2]:
rev_m=127125 # revenue at full capacity
rev_stdev=13000 # assume that amount of standart deviation
iterations=10000 # number of random simulations


Calculation of simulated revenue with the help of random function

In [3]:
rev=np.random.normal(rev_m, rev_stdev, iterations)
rev

Out[3]:
array([120564.7739602 , 132275.32933778, 116220.16065841, ...,
127380.19762231, 136514.82633727, 125153.46239481])

Visualizing our outcome

In [4]:
trace = go.Scatter(
x = [i for i in range(1, 10001)],
y = rev,
mode = 'lines'
)
layout = go.Layout(
title = 'Random annual revenue calculation',
xaxis_title_text = 'Iterations',
yaxis_title_text = 'Revenue, $') fig = go.Figure(data = trace, layout = layout) fig.show()  We estimated share of COGS as 0.52197 of the revenue, based on that simulated 10000 COGS and vizualized it In [5]: COGS=-(rev*np.random.normal(0.52197,0.1)) trace = go.Scatter( x = [i for i in range(1, 10001)], y = COGS, mode = 'lines' ) layout = go.Layout( title = 'Random annual COGS calculation', xaxis_title_text = 'Iterations', yaxis_title_text = 'COGS,$')
fig = go.Figure(data = trace, layout = layout)
fig.show()


Mean value of COGS

In [6]:
COGS.mean()

Out[6]:
-50704.006327176234

Standart deviation of COGS

In [7]:
COGS.std()

Out[7]:
5164.477157268804

Gross Profit estimation and vizualization

In [8]:
Gross_Profit=rev+COGS
trace = go.Scatter(
x = [i for i in range(1, 10001)],
y = Gross_Profit,
mode = 'lines'
)
layout = go.Layout(
title = 'Random annual Gross Profit calculation',
xaxis_title_text = 'Iterations',
yaxis_title_text = 'Gross Profit, $') fig = go.Figure(data = trace, layout = layout) fig.show()  Maximum Gross Profit In [9]: max(Gross_Profit)  Out[9]: 105596.12816267031 Minimum Gross Profit In [10]: min(Gross_Profit)  Out[10]: 44571.350049841996 We may see that minimum amount of Gross Profit cover our fixed costs which equals$29 344

Mean value of Gross Profit

In [11]:
Gross_Profit.mean()

Out[11]:
76271.63550992012

Standart deviation of Gross Profit

In [12]:
Gross_Profit.std()

Out[12]:
7768.678411658196

Gross Profit histogram

In [13]:
trace = go.Histogram(
x = Gross_Profit
)
layout = go.Layout(
title = 'Random annual Gross Profit distribution',
xaxis_title_text = 'Gross Profit \$')
fig = go.Figure(data = trace, layout = layout)
fig.show()

In [ ]: