PyProcess
PyProcess copied to clipboard
Bug in Wiener_process sample_path when conditional
First, great library!
Second, I think there is a bug when the Wiener_process is conditional (e.g. has a startPosition and an endPosition). When _sample_path is called, the startPosition is ultimately ignored in the conditional branch of the code. I believe that branch of the code should read:
else:
"""
Alternatively, this can be accomplished by sampling directly from a multivariate normal given a linear
projection. Ie
N | N dot 1 = endPosition ~ Nor( 0, Sigma ), where Sigma is a diagonal matrix with elements proportional to
the delta. This only problem with this is Sigma is too large for very large len(times).
"""
T = self.endTime - self.startTime
x = self.startTime
for i, delta in enumerate( deltas ):
x = x*(1-delta/T) + (self.endPosition - self.startPosition)*delta/T + self.sigma*np.sqrt(delta/T*(T-delta))*self.Nor.rvs(N)
T = T - delta
path[:,i] = x
if abs(T -0)<1e-10:
path[:,-1] = (self.endPosition - self.startPosition)
path = path + self.startPosition
Usefull library ;) I want to generate a sample path using the Integrated_OU_process and I saw your comment " #there is an error here, I can smell it". Did you figure out what is it? Do you mean an error on the formula or somewhere in the code? THX
Hey, this repo is unmaintained and shouldn't be used.