Esempio n. 1
0
    start_params = [.4, 1.1]
    param_names = ['theta', 'sigma2']

    def __init__(self, endog):
        super().__init__(endog, k_states=2)
        self['transition', 0, 1] = 1.0
        self['design', 0, 0] = 1.0
        self['selection', 0, 0] = 1.0

        self.initialize_stationary()

    def update(self, params, **kwargs):

        self['selection', 1, 0] = params[0]
        self['state_cov', 0, 0] = params[1]


model1 = MAmodel(y_invertible)
model1_fit = model1.fit(method='bfgs', miniter=1000)

model1_fit.summary()
y_invertible[0:10]
model1_fit.smoothed_state[0:10, :]
y_with_outlier = y_noninvertible
y_with_outlier[5] = 1200.0

model2 = MAmodel(y_with_outlier)

filtered3 = model2.filter([2.5, 1.2])
filtered3.filtered_state[0, :]