I have:
np.random.seed(123)
def v_t(var_v, T):
v_t_ = np.zeros([T,1])
v_t_[1:T] = (var_v ** 0.5) * np.random.randn(len(v_t_) - 1, 1)
return v_t_
def s_t(rho, T):
v_t_ = v_t(var_v, T)
s_t_ = np.zeros([T,1])
s_t_[0] = 0
for t in range(1,T):
s_t_[t] = rho *s_t_[t-1] + v_t_[t]
return s_t_
However every time I call one of the values, ie
s_t(rho, T) "or" v_t(var_v, T)
the right value is shown. But directly afterwards, when I call the other value, the value is wrong. (Probably due to some time series effect.) After I clear my namespace, when I call the functions in the mirrored sequence, the same holds true. How do I get the right values displayed for every call without resetting the namespace???
Would be great to hear from you! Cheers, Tobias
我认为问题与np.random.randn(len(v_t_)-1,1)有关...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.