'Test for normality of standardized residuals.
Null hypothesis is normality.
Parameters
method : string {\'jarquebera\'} or None
The statistical test for normality. Must be \'jarquebera\' for
Jarque-Bera normality test. If None, an attempt is made to select
an appropriate test.
Notes
If the first `d` loglikelihood values were burned (i.e. in the
specified model, `loglikelihood_burn=d`), then this test is calculated
ignoring the first `d` residuals.
In the case of missing data, the maintained hypothesis is that the
data are missing completely at random. This test is then run on the
standardized residuals excluding those corresponding to missing
observations.
See Also
statsmodels.stats.stattools.jarque_bera'

def test_normality(self, method):

    if (method is None):
        method = 'jarquebera'
    if (method == 'jarquebera'):
        from statsmodels.stats.stattools import jarque_bera
        d = self.loglikelihood_burn
        output = []
        for i in range(self.model.k_endog):
            resid = self.filter_results.standardized_forecasts_error[i, d:]
            mask = (~ np.isnan(resid))
            output.append(jarque_bera(resid[mask]))
    else:
        raise NotImplementedError('Invalid    normality    test    method.')
    return np.array(output)
