AR(1):
Python Code:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib auto
num = 500
np.random.seed(1000)
epsilon1 = np.random.normal(0,1,num)
epsilon2 = np.random.normal(0,1,num)
epsilon3 = np.random.normal(0,1,num)
x1 = np.empty(num)
x2 = np.empty(num)
x3 = np.empty(num)
t=np.linspace(1,500,500)
rho = 1
x1[0] = 0
for i in range(1,num):
x1[i] = rho*x1[i-1]+epsilon1[i]
x2[0] = 0
for i in range(1,num):
x2[i] = rho*x2[i-1]+epsilon2[i]
x3[0] = 0
for i in range(1,num):
x3[i] = rho*x3[i-1]+epsilon3[i]
plt.plot(t,x1)
plt.plot(t,x2)
plt.plot(t,x3)
plt.show()
The following figure gives 3 realizations (sample paths) of the model.
Result: