@@ -501,8 +501,8 @@ r = 0.05
501501T = 60
502502
503503@jit
504- def time_path(T):
505- w = np.random.randn (T+1) # w_0, w_1, ..., w_T
504+ def time_path(T, rng ):
505+ w = rng.standard_normal (T+1) # w_0, w_1, ..., w_T
506506 w[0] = 0
507507 b = np.zeros(T+1)
508508 for t in range(1, T+1):
@@ -511,7 +511,8 @@ def time_path(T):
511511 c = μ + (1 - β) * (σ * w - b)
512512 return w, b, c
513513
514- w, b, c = time_path(T)
514+ rng = np.random.default_rng()
515+ w, b, c = time_path(T, rng)
515516
516517fig, ax = plt.subplots(figsize=(10, 6))
517518
@@ -534,7 +535,7 @@ fig, ax = plt.subplots(figsize=(10, 6))
534535
535536b_sum = np.zeros(T+1)
536537for i in range(250):
537- w, b, c = time_path(T) # Generate new time path
538+ w, b, c = time_path(T, rng ) # Generate new time path
538539 rcolor = random.choice(('c', 'g', 'b', 'k'))
539540 ax.plot(c, color=rcolor, lw=0.8, alpha=0.7)
540541
10251026[ ^ f5 ] : 如果由$y^t$张成的线性空间等于由$w^t$张成的线性空间,则过程$y_t$的移动平均表示被称为** 基本的** 。通过卡尔曼滤波获得的时不变创新表示在构造上是基本的。
10261027
10271028[ ^ f8 ] : 相关思想的有趣应用请参见{cite}` CampbellShiller88 ` 、{cite}` LettLud2001 ` 、{cite}` LettLud2004 ` 。
1028-
0 commit comments