Skip to content

Instantly share code, notes, and snippets.

@SaremS
Last active May 9, 2023 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SaremS/32b7825a4cb730f5f9812a0e77f751d9 to your computer and use it in GitHub Desktop.
Save SaremS/32b7825a4cb730f5f9812a0e77f751d9 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(987)
#cauchy distribution is equivalent to a Student-T with 1 degree of freedom
#see https://stats.stackexchange.com/questions/151854/a-normal-divided-by-the-sqrt-chi2s-s-gives-you-a-t-distribution-proof
heavy_tailed_noise = np.random.normal(size = (120))/np.sqrt(np.random.normal(size = (120))**2)
seasonal_series = np.cumsum(heavy_tailed_noise.reshape((10,12)),0).reshape(-1)
fig, axs = plt.subplots(figsize = (24,8), nrows=1, ncols=2)
axs[0].plot(heavy_tailed_noise,color="blue")
axs[0].margins(x=0)
axs[0].grid(alpha=0.5)
axs[1].plot(seasonal_series,color="blue")
axs[1].margins(x=0)
axs[1].grid(alpha=0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment