crflynn / fbm

Exact methods for simulating fractional Brownian motion and fractional Gaussian noise in python
MIT License
96 stars 29 forks source link

make if multi fractional? #3

Closed weihangChen closed 6 years ago

weihangChen commented 6 years ago

First of all, I really appreciate your API here. One thing is that, this project is fractional, not multifractional. Right now I just add a method insdie of "_autocovariance" so the hurst value get updated continously based on a ramp function etc. It will be greate if support for multifractional can be added, because this project is one of the few out there in python. Great Work!!


    def _autocovariance(self, k):
        self.adjust_hurst(k)
        """The autocovariance for fgn."""
        return 0.5 * (abs(k - 1) ** (2 * self.hurst) -
                      2 * abs(k) ** (2 * self.hurst) +
                      abs(k + 1) ** (2 * self.hurst))
crflynn commented 6 years ago

Hi @weihangChen. Thanks for the kind words regarding the API.

I'll do some research on mBm. I'm not familiar with any exact methods for discretely sampling mBm, but it looks like allowing the Hurst exponent to vary with respect to time makes it difficult. However, I found a few approximate methods that might be a bit more appropriate than what you suggested, and I'll give it some consideration. Thanks for the suggestion.

crflynn commented 6 years ago

@weihangChen, I just merged #4 and pushed new version of the package v0.2.0 to pypi which includes an MBM class for multifractional Brownian motion. Please give it a try.

weihangChen commented 6 years ago

@crflynn , many thanks!

weihangChen commented 6 years ago

@crflynn , I just finished the update of my project using your implementation of mfbm, many thanks!!