class_docstr: Inherits time series methods from TSM class.
  
  **** VECTOR AUTOREGRESSION (VAR) MODELS ****
  
  Parameters
  ----------
  data : pd.DataFrame or np.array
      Field to specify the time series data that will be used.
  
  lags : int
      Field to specify how many lag terms the model will have. 
  
  integ : int (default : 0)
      Specifies how many time to difference the dependent variables.
  
  target : str (pd.DataFrame) or int (np.array)
      Specifies which column name or array index to use. By default, first
      column/array will be selected as the dependent variable.
  
  use_ols_covariance : Boolean
      If true use OLS covariance; if false use estimated covariance
class_docstr_tok: ["Inherits","time","series","methods","from","TSM","class",".","*","*","*","*","VECTOR","AUTOREGRESSION","(","VAR",")","MODELS","*","*","*","*","Parameters","--","--","--","--","--","data",":","pd.DataFrame","or","np.array","Field","to","specify","the","time","series","data","that","will","be","used",".","lags",":","int","Field","to","specify","how","many","lag","terms","the","model","will","have",".","integ",":","int","(","default",":","0",")","Specifies","how","many","time","to","difference","the","dependent","variables",".","target",":","str","(","pd.DataFrame",")","or","int","(","np.array",")","Specifies","which","column","name","or","array","index","to","use",".","By","default",",","first","column\/array","will","be","selected","as","the","dependent","variable",".","use_ols_covariance",":","Boolean","If","true","use","OLS","covariance",";","if","false","use","estimated","covariance"]
code: def __init__(
      self, data, lags, target=None, integ=0, use_ols_covariance=False
  ):
      # Initialize TSM object
      super(VAR, self).__init__("VAR")
  
      self.neg_logposterior = self.multivariate_neg_logposterior
  
      # Use uncythonized version of this function for older Pythons
      if sys.version_info < (3,):
          self.create_design_matrix = create_design_matrix_2
      else:
          self.create_design_matrix = create_design_matrix
  
      # Latent Variables
      self.lags = lags
      self.integ = integ
      self.max_lag = lags
      self.model_name = "VAR(" + str(self.lags) + ")"
      self.supported_methods = [
          "OLS",
          "MLE",
          "PML",
          "Laplace",
          "M-H",
          "BBVI",
      ]
      self.default_method = "OLS"
      self.multivariate_model = True
      self.use_ols_covariance = use_ols_covariance
  
      # Format the data
      self.data_original = data.copy()
      (
          self.data,
          self.data_name,
          self.is_pandas,
          self.index,
      ) = dc.mv_data_check(data, target)
  
      # Difference data
      X = np.transpose(self.data)
      for order in range(self.integ):
          X = np.asarray([np.diff(i) for i in X])
          self.data_name = np.asarray(
              ["Differenced " + str(i) for i in self.data_name]
          )
      self.data = X
      self.ylen = self.data_name.shape[0]
  
      self._create_latent_variables()
  
      # Other attributes
      self._z_hide = (
          np.power(self.data.shape[0], 2)
          - (np.power(self.data.shape[0], 2) - self.data.shape[0]) / 2
      )  # Whether to cutoff variance latent variables from results
      self.z_no = len(self.latent_variables.z_list)
  
imports: import sys
  import numpy
  import pandas
  import scipy.stats
  import datetime
  from ..None import families
  from ..None import output
  from ..None import tests
  from ..None import tsm
  from ..None import data_check
  from .var_recursions import create_design_matrix, custom_covariance_matrix, var_likelihood
label_desc: Use image node_id 1 to create a new VAR object from inherited base classes: tsm with example: obj = VAR(data, lags, target, integ, use_ols_covariance)