# Monte Carlo Simulation

Revenue, COGS, Gross Profit simulation for business-planning

Last updated: May 25th, 2020

Import libraries necessary to work with

In :
import numpy as np
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
from plotly import graph_objects as go
init_notebook_mode(connected=True)


Estimate our variables

In :
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 :
rev=np.random.normal(rev_m, rev_stdev, iterations)
rev

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

Visualizing our outcome

In :
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 : 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 :
COGS.mean()

Out:
-50704.006327176234

Standart deviation of COGS

In :
COGS.std()

Out:
5164.477157268804

Gross Profit estimation and vizualization

In :
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 : max(Gross_Profit)  Out: 105596.12816267031 Minimum Gross Profit In : min(Gross_Profit)  Out: 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 :
Gross_Profit.mean()

Out:
76271.63550992012

Standart deviation of Gross Profit

In :
Gross_Profit.std()

Out:
7768.678411658196

Gross Profit histogram

In :
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 [ ]: