<jupyter_start><jupyter_text><jupyter_code>import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
N = 500
seriesNoise = np.random.normal(loc=0.0, scale = 2, size = N)
plt.plot(seriesNoise)
a = 0.2
seriesTrend = [x*a for x in range(0,N)]
plt.plot(seriesTrend)
plt.plot(seriesTrend + seriesNoise)
series1 = np.array(seriesTrend + seriesNoise)
ss2 = series1[0:-2] - series1[1:-1]
# len(series1[1:-1])
plt.plot(ss2)
series2 = []
s_t_1 = 0.0
s_t_2 = 0.0

alpha = 1.4

beta = -.41

for i in range(0,N):
  series2.append(alpha*s_t_1 + beta*s_t_2 + seriesNoise[i])
  s_t_1 = series2[i] 
  if(i>=1):
    s_t_2 = series2[i-1]

# alpha = 0.99
# s_t_1 = 0.0

# for t in range(0,N):
#   series2.append(alpha*s_t_1 + seriesNoise[t])
#   s_t_1 = series2[t]

plt.plot(series2)
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
plot_pacf(series2, lags=10);
plot_acf(series2, lags=40);
series2_shifted = np.array(series2[1:])
series_diff = np.array(series2[0:-1]) - series2_shifted
plt.plot(series_diff)
# plt.plot(series2_shifted)
# plt.plot(series2[1:])
plot_acf(series_diff, lags=30)
plot_pacf(series_diff, lags=30);
plt.plot(series_diff)
series2_shifted = np.array(series_diff[1:])
series_diff2 = np.array(series_diff[0:-1]) - series2_shifted
plt.plot(series_diff2)

plot_pacf(series_diff2, lags=30);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15550595238095238, 'fraction_numerical': 0.0625, 'mean_word_length': 5.560975609756097, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '181137', 'license': 'MIT', 'n_tokens_mistral': 643, 'n_tokens_neox': 612, 'n_words': 104, 'path': 'time_series.ipynb', 'repo_name': 'MarkVoitov/DS_ABB', 'size': '1344'}