Skip to content

Instantly share code, notes, and snippets.

@arif9799
Last active October 1, 2022 10:28
Show Gist options
  • Save arif9799/e4d8a38a9d92499bf28ea37c77f6720e to your computer and use it in GitHub Desktop.
Save arif9799/e4d8a38a9d92499bf28ea37c77f6720e to your computer and use it in GitHub Desktop.
Time Series Prediction Interval - Stock Price Predictions Animation Code
import pandas as pd
import numpy as np
import seaborn as sb
import matplotlib.pyplot as plt
from matplotlib import rcParams
from cycler import cycler
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import math
rcParams['figure.figsize'] = 17,8
rcParams['lines.linewidth'] = 2.5
plt.tick_params(axis='x', which='both', bottom=False, labelbottom=False)
plt.tick_params(axis='y', which='both', left=False, labelleft=False)
sb.despine(right = True, top = True, bottom = True, left = True)
mu = -6
sigma = 1
x = np.linspace(mu - 3*sigma, mu + 3*sigma, 100)
plt.plot(x, stats.norm.pdf(x, mu, sigma), color = '#000080')
mu = 0
sigma = 1
x = np.linspace(mu - 3*sigma, mu + 3*sigma, 100)
plt.plot(x, stats.norm.pdf(x, mu, sigma), color = '#000080')
mu = 6
sigma = 1
x = np.linspace(mu - 3*sigma, mu + 3*sigma, 100)
plt.plot(x, stats.norm.pdf(x, mu, sigma), color = '#000080')
plt.arrow(0, 0.5, -9, 0, head_width = 0.05, head_length = 0, color = 'green')
plt.arrow(0, 0.5, 9, 0, head_width = 0.05, head_length = 0, color = 'green')
plt.arrow(-6, -0.1, -3, 0, head_width = 0.05, head_length = 0, color = 'orange')
plt.arrow(-6, -0.1, 3, 0, head_width = 0.05, head_length = 0, color = 'orange')
plt.arrow(0, -0.1, -3, 0, head_width = 0.05, head_length = 0, color = 'orange')
plt.arrow(0, -0.1, 3, 0, head_width = 0.05, head_length = 0, color = 'orange')
plt.arrow(6, -0.1, -3, 0, head_width = 0.05, head_length = 0, color = 'orange')
plt.arrow(6, -0.1, 3, 0, head_width = 0.05, head_length = 0, color = 'orange')
plt.text(0, 0.48, 'STANDARD ERROR - ACROSS THE SAMPLES')
plt.text(0, -0.09, 'STANDARD DEVIATION - SAMPLE 1')
plt.text(-6, -0.09, 'STANDARD DEVIATION - SAMPLE 2')
plt.text(6, -0.09, 'STANDARD DEVIATION - SAMPLE 3')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment