### Navigation

- index
- modules |
- previous |
- Quantitative Finance »

# Markov Switching Multifractal model

REFERENCE:

How to Forecast Long-Run Volatility: Regime Switching and the Estimation of Multifractal Processes, Calvet and Fisher, 2004.

AUTHOR:

- William Stein, 2008

TESTS:

    sage: msm = finance.MarkovSwitchingMultifractal(8,1.4,1.0,0.95,3)
    sage: loads(dumps(msm)) == msm
    True

class `sage.finance.markov_multifractal.``MarkovSwitchingMultifractal`(kbar, m0, sigma, gamma_kbar, b)

  INPUT:

  - `kbar` – positive integer
  - `m0` – float with `0 <= m0 <= 2`
  - `sigma` – positive float
  - `gamma_kbar` – float with `0 <= gamma_kbar < 1`
  - `b` – float > 1

  EXAMPLES:

      sage: msm = finance.MarkovSwitchingMultifractal(8,1.4,0.5,0.95,3); msm
      Markov switching multifractal model with m0 = 1.4, sigma = 0.5, b = 3.0, and gamma_8 = 0.95
      sage: yen_usd = finance.MarkovSwitchingMultifractal(10,1.448,0.461,0.998,3.76)
      sage: cad_usd = finance.MarkovSwitchingMultifractal(10,1.278,0.262,0.644,2.11)
      sage: dm = finance.MarkovSwitchingMultifractal(10,1.326,0.643,0.959,2.7)

  `b`()

    Return parameter b of Markov switching multifractal model.

    EXAMPLES:

        sage: msm = finance.MarkovSwitchingMultifractal(8,1.4,1,0.95,3)
        sage: msm.b()
        3.0

  `gamma`()

    Return the vector of the kbar transitional probabilities.

    OUTPUT:

    - gamma – a tuple of `self.kbar()` floats.

    EXAMPLES:

        sage: msm = finance.MarkovSwitchingMultifractal(8,1.4,1.0,0.95,3)
        sage: msm.gamma()
        (0.001368852970712986, 0.004100940201672509, 0.012252436441829..., 0.03630878209190..., 0.10501923017634..., 0.28312883556311..., 0.6315968501359..., 0.95000000000000...)

  `gamma_kbar`()

    Return parameter `gamma_kbar` of Markov switching multifractal model.

    EXAMPLES:

        sage: msm = finance.MarkovSwitchingMultifractal(8,1.4,0.01,0.95,3)
        sage: msm.gamma_kbar()
        0.95

  `kbar`()

    Return parameter `kbar` of Markov switching multifractal model.

    EXAMPLES:

        sage: msm = finance.MarkovSwitchingMultifractal(8,1.4,0.01,0.95,3)
        sage: msm.kbar()
        8

  `m0`()

    Return parameter m0 of Markov switching multifractal model.

    EXAMPLES:

        sage: msm = finance.MarkovSwitchingMultifractal(8,1.4,1,0.95,3)
        sage: msm.m0()
        1.4

  `sigma`()

    Return parameter sigma of Markov switching multifractal model.

    EXAMPLES:

        sage: msm = finance.MarkovSwitchingMultifractal(8,1.4,1,0.95,3)
        sage: msm.sigma()
        1.0

  `simulation`(n)

    Same as `self.simulations`, but run only 1 time, and returns a time series instead of a list of time series.

    INPUT:

    - `n` – a positive integer.

    EXAMPLES:

        sage: msm = finance.MarkovSwitchingMultifractal(8,1.4,1.0,0.95,3)
        sage: msm.simulation(5)
        [0.0059, -0.0097, -0.0101, -0.0110, -0.0067]
        sage: msm.simulation(3)
        [0.0055, -0.0084, 0.0141]

  `simulations`(n, k=1)

    Return `k` simulations of length `n` using this Markov switching multifractal model for `n` time steps.

    INPUT:

    - `n` – positive integer; number of steps.
    - `k` – positive integer (default: 1); number of simulations.

    OUTPUT:

    list – a list of TimeSeries objects.

    EXAMPLES:

        sage: cad_usd = finance.MarkovSwitchingMultifractal(10,1.278,0.262,0.644,2.11); cad_usd
        Markov switching multifractal model with m0 = 1.278, sigma = 0.262, b = 2.11, and gamma_10 = 0.644

### Navigation

- index
- modules |
- previous |
- Quantitative Finance »