Skip to content

Instantly share code, notes, and snippets.

@jdmoore7
Created December 8, 2021 17:32
Show Gist options
  • Save jdmoore7/de6ac3f6bb335b5941a53b28e2309392 to your computer and use it in GitHub Desktop.
Save jdmoore7/de6ac3f6bb335b5941a53b28e2309392 to your computer and use it in GitHub Desktop.
Demand curve simulation
import numpy as np
sd = 0.5
m,b = -0.25, 5
X = np.linspace(0,20,100)
Y = np.exp(np.random.normal(loc=m*X+b, scale=sd))
import matplotlib.pyplot as plt
plt.scatter(X,Y)
Y_hat = np.exp(m*X+b)
plt.plot(X,Y_hat, color='r')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment