class_docstr: Inherits time series methods from TSM parent class.
  
  **** NEURAL NETWORK AUTOREGRESSIVE INTEGRATED (NNAR) MODELS ****
  
  Parameters
  ----------
  data : pd.DataFrame or np.ndarray
      Field to specify the univariate time series data that will be used.
  
  ar : int
      Field to specify how many AR lags the model will have.
  
  integ : int (default : 0)
      Specifies how many times to difference the time series.
  
  units : int
      How many units for the neural network
  
  layers : int
      How many layers for the neural networ
  
  activation : function
      E.g. np.tanh, np.array (linear)
  
  target : str (if data is a pd.DataFrame) or int (if data is a np.ndarray)
      Specifies which column name or array index to use. By default, first
      column/array index will be selected as the dependent variable.
  
  family: family object
      E.g. pf.Normal()
  
  activation : function
      Non-linear transformation for the weights, e.g. np.tanh
  
  initialize_random : boolean
      Whether to initialzie the weights with N(0,1) random variables
class_docstr_tok: ["Inherits","time","series","methods","from","TSM","parent","class",".","*","*","*","*","NEURAL","NETWORK","AUTOREGRESSIVE","INTEGRATED","(","NNAR",")","MODELS","*","*","*","*","Parameters","--","--","--","--","--","data",":","pd.DataFrame","or","np.ndarray","Field","to","specify","the","univariate","time","series","data","that","will","be","used",".","ar",":","int","Field","to","specify","how","many","AR","lags","the","model","will","have",".","integ",":","int","(","default",":","0",")","Specifies","how","many","times","to","difference","the","time","series",".","units",":","int","How","many","units","for","the","neural","network","layers",":","int","How","many","layers","for","the","neural","networ","activation",":","function","E.g",".","np.tanh",",","np.array","(","linear",")","target",":","str","(","if","data","is","a","pd.DataFrame",")","or","int","(","if","data","is","a","np.ndarray",")","Specifies","which","column","name","or","array","index","to","use",".","By","default",",","first","column\/array","index","will","be","selected","as","the","dependent","variable",".","family",":","family","object","E.g",".","pf.Normal","(",")","activation",":","function","Non-linear","transformation","for","the","weights",",","e.g",".","np.tanh","initialize_random",":","boolean","Whether","to","initialzie","the","weights","with","N","(","0,1",")","random","variables"]
docstr: Plots histogram of the discrepancy from draws of the posterior
  
  Parameters
  ----------
  nsims : int (default : 1000)
      How many draws for the PPC
  
  T : function
      A discrepancy measure - e.g. np.mean, np.std, np.max
docstr_tok: ["Plots","histogram","of","the","discrepancy","from","draws","of","the","posterior","Parameters","--","--","--","--","--","nsims",":","int","(","default",":","1000",")","How","many","draws","for","the","PPC","T",":","function","A","discrepancy","measure","-","e.g",".","np.mean",",","np.std",",","np.max"]
code: def plot_ppc(self, nsims=1000, T=np.mean, **kwargs):
      """Plots histogram of the discrepancy from draws of the posterior
  
      Parameters
      ----------
      nsims : int (default : 1000)
          How many draws for the PPC
  
      T : function
          A discrepancy measure - e.g. np.mean, np.std, np.max
      """
      if self.latent_variables.estimation_method not in ["BBVI", "M-H"]:
          raise Exception("No latent variables estimated!")
      else:
          import matplotlib.pyplot as plt
          import seaborn as sns
  
          figsize = kwargs.get("figsize", (10, 7))
  
          lv_draws = self.draw_latent_variables(nsims=nsims)
          mus = [self._model(lv_draws[:, i])[0] for i in range(nsims)]
          (
              model_scale,
              model_shape,
              model_skewness,
          ) = self._get_scale_and_shape_sim(lv_draws)
          data_draws = np.array(
              [
                  self.family.draw_variable(
                      self.link(mus[i]),
                      np.repeat(model_scale[i], mus[i].shape[0]),
                      np.repeat(model_shape[i], mus[i].shape[0]),
                      np.repeat(model_skewness[i], mus[i].shape[0]),
                      mus[i].shape[0],
                  )
                  for i in range(nsims)
              ]
          )
          T_sim = T(self.sample(nsims=nsims), axis=1)
          T_actual = T(self.data)
  
          if T == np.mean:
              description = " of the mean"
          elif T == np.max:
              description = " of the maximum"
          elif T == np.min:
              description = " of the minimum"
          elif T == np.median:
              description = " of the median"
          else:
              description = ""
  
          plt.figure(figsize=figsize)
          ax = plt.subplot()
          ax.axvline(T_actual)
          sns.distplot(T_sim, kde=False, ax=ax)
          ax.set(
              title="Posterior predictive" + description,
              xlabel="T(x)",
              ylabel="Frequency",
          )
          plt.show()
  
imports: import sys
  import numpy
  import pandas
  import scipy.stats
  from ..None import families
  from ..None import output
  from ..None import tests
  from ..None import tsm
  from ..None import data_check
  from .nn_architecture import neural_network_tanh, neural_network_tanh_mb
label_desc: Use image node_id 23 for calling the NNAR obj's underlying member method code with example usage: obj.plot_ppc(nsims, T) without return types