Created
January 28, 2020 04:16
-
-
Save marufeuille/edaab09029043c429a32c11083c0d6ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate(phi_1, phi_2, c, sigma, size): | |
# 期待値 | |
mu = c/(1-phi_1-phi_2) | |
# 乱数のseedを固定 | |
np.random.seed(17) | |
# データの生成 | |
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