code: def __init__(self, y):
      # Create a matrix with [y_t' : y_{t-1}'] for t = 2, ..., T
      augmented = sm.tsa.lagmat(
          y, 1, trim="both", original="in", use_pandas=True
      )
      # Separate into y_t and z_t = [1 : y_{t-1}']
      p = y.shape[1]
      y_t = augmented.iloc[:, :p]
      z_t = sm.add_constant(augmented.iloc[:, p:])
  
      # Recall that the length of the state vector is p * (p + 1)
      k_states = p * (p + 1)
      super().__init__(y_t, exog=z_t, k_states=k_states)
  
      # Note that the state space system matrices default to contain zeros,
      # so we don't need to explicitly set c_t = d_t = 0.
  
      # Construct the design matrix Z_t
      # Notes:
      # -> self.k_endog = p is the dimension of the observed vector
      # -> self.k_states = p * (p + 1) is the dimension of the observed vector
      # -> self.nobs = T is the number of observations in y_t
      self["design"] = np.zeros(
          (self.k_endog, self.k_states, self.nobs)
      )
      for i in range(self.k_endog):
          start = i * (self.k_endog + 1)
          end = start + self.k_endog + 1
          self["design", i, start:end, :] = z_t.T
  
      # Construct the transition matrix T = I
      self["transition"] = np.eye(k_states)
  
      # Construct the selection matrix R = I
      self["selection"] = np.eye(k_states)
  
      # Step 3: Initialize the state vector as alpha_1 ~ N(0, 5I)
      self.ssm.initialize(
          "known", stationary_cov=5 * np.eye(self.k_states)
      )
  
file_path: statsmodels/examples/python/statespace_tvpvar_mcmc_cfa.py
imports: from importlib import reload
  import numpy
  import pandas
  import statsmodels.api
  import matplotlib.pyplot
  from scipy.stats import invwishart, invgamma
  import arviz
  from statsmodels.tsa.statespace.simulation_smoother import SIMULATION_STATE
label_desc: Use image node_id 1 to create a new TVPVAR object from inherited base classes: sm.tsa.statespace with example: obj = TVPVAR(y)