Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def generate(phi_1, phi_2, c, sigma, size):
# 期待値
mu = c/(1-phi_1-phi_2)
# 乱数のseedを固定
# データの生成
ar_data = np.zeros(size)
ar_data[0] = mu + np.random.normal(0, sigma)
ar_data[1] = mu + np.random.normal(0, sigma)
for t in range(2, size):
ar_data[t] = c + phi_1*ar_data[t-1] + phi_2*ar_data[t-2] + np.random.normal(0, sigma)
return ar_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment