def plot_fit(self, **kwargs):
        """ Plots the fit of the model

        Returns
        ----------
        None (plots data and the fit)
        """
        import matplotlib.pyplot as plt
        import seaborn as sns

        figsize = kwargs.get('figsize',(10,7))

        if self.latent_variables.estimated is False:
            raise Exception("No latent variables estimated!")
        else:
            plt.figure(figsize=figsize)
            date_index = self.index[max(self.p, self.q):]
            t_params = self.transform_z()
            sigma2, Y, ___ = self._model(self.latent_variables.get_z_values())
            plt.plot(date_index, np.abs(Y-t_params[-1]), label=self.data_name + ' Absolute Demeaned Values')
            plt.plot(date_index, np.power(sigma2,0.5), label='GARCH(' + str(self.p) + ',' + str(self.q) + ') Conditional Volatility',c='black')
            plt.title(self.data_name + " Volatility Plot")  
            plt.legend(loc=2)   
            plt.show()
def plot_fit ( self , ** kwargs ) : import matplotlib . pyplot as plt import seaborn as sns figsize = kwargs . get ( 'figsize' , ( 10 , 7 ) ) if self . latent_variables . estimated is False : raise Exception ( "No latent variables estimated!" ) else : plt . figure ( figsize = figsize ) date_index = self . index [ max ( self . p , self . q ) : ] t_params = self . transform_z ( ) sigma2 , Y , ___ = self . _model ( self . latent_variables . get_z_values ( ) ) plt . plot ( date_index , np . abs ( Y - t_params [ - 1 ] ) , label = self . data_name + ' Absolute Demeaned Values' ) plt . plot ( date_index , np . power ( sigma2 , 0.5 ) , label = 'GARCH(' + str ( self . p ) + ',' + str ( self . q ) + ') Conditional Volatility' , c = 'black' ) plt . title ( self . data_name + " Volatility Plot" ) plt . legend ( loc = 2 ) plt . show ( )
Plots the fit of the model

        Returns
        ----------
        None (plots data and the fit)