<jupyter_start><jupyter_text>模拟一个Random Walk<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
x=np.random.normal(0,1,1000)
for t in range(1,1000):
    x[t]=x[t-1]+x[t]
plt.plot(x)<jupyter_output><empty_output><jupyter_text>绘制自相关图<jupyter_code>from statsmodels.graphics.tsaplots import plot_acf
plot_acf(x)<jupyter_output><empty_output><jupyter_text>计算一阶差分序列，并绘制自相关图<jupyter_code>plot_acf(np.diff(x))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13513513513513514, 'fraction_numerical': 0.02702702702702703, 'mean_word_length': 12.90625, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '414571', 'license': 'MIT', 'n_tokens_mistral': 220, 'n_tokens_neox': 216, 'n_words': 20, 'path': 'References/Data.Analysis/TimeSeries/4-2-7.simulation.ipynb', 'repo_name': 'royqh1979/python_libs_usage', 'size': '444'}