MIDAS Weights


In [1]:
%matplotlib inline

import numpy as np
import pandas as pd

from midas.weights import BetaWeights, ExpAlmonWeights

Beta Weights


In [2]:
nlags=20
bw1 = BetaWeights(1., 5.)
bw2 = BetaWeights(1., 3.)
bw3 = BetaWeights(1.5, 5.)

pd.DataFrame({'w1': bw1.weights(nlags),
              'w2': bw2.weights(nlags),
              'w3': bw3.weights(nlags)}).plot()


Out[2]:
<matplotlib.axes._subplots.AxesSubplot at 0x10ca81668>

Exponential Almon Weights


In [3]:
nlags=20
eaw1 = ExpAlmonWeights(0.01, -0.0025)
eaw2 = ExpAlmonWeights(0.01, -0.0099)
eaw3 = ExpAlmonWeights(0.099, -0.0099)

pd.DataFrame({'w1': eaw1.weights(nlags),
              'w2': eaw2.weights(nlags),
              'w3': eaw3.weights(nlags)}).plot()


Out[3]:
<matplotlib.axes._subplots.AxesSubplot at 0x10fe1fb00>

Beta Weights with Non-Zero Last Lag


In [4]:
nlags=20
bw1 = BetaWeights(1., 5., 0.1)
bw2 = BetaWeights(1., 3., 0.1)
bw3 = BetaWeights(1.5, 5., 0.1)

pd.DataFrame({'w1': bw1.weights(nlags),
              'w2': bw2.weights(nlags),
              'w3': bw3.weights(nlags)}).plot()


Out[4]:
<matplotlib.axes._subplots.AxesSubplot at 0x10fe7db00>

In [ ]: