PyProcess icon indicating copy to clipboard operation
PyProcess copied to clipboard

Bug in Wiener_process sample_path when conditional

Open choffstein opened this issue 10 years ago • 2 comments

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

choffstein avatar Mar 02 '15 19:03 choffstein

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

AthosFiori avatar Dec 12 '17 17:12 AthosFiori

Hey, this repo is unmaintained and shouldn't be used.

CamDavidsonPilon avatar Dec 12 '17 23:12 CamDavidsonPilon