class_docstr: obsolete VAR class, use tsa.VAR instead, for internal use only
  
  
  Examples
  --------
  
  >>> v = Var(ar2s)
  >>> v.fit(1)
  >>> v.arhat
  array([[[ 1.        ,  0.        ],
          [ 0.        ,  1.        ]],
  
         [[-0.77784898,  0.01726193],
          [ 0.10733009, -0.78665335]]])
class_docstr_tok: ["obsolete","VAR","class",",","use","tsa.VAR","instead",",","for","internal","use","only","Examples","--","--","--","--",">",">",">","v","=","Var","(","ar2s",")",">",">",">","v.fit","(","1",")",">",">",">","v.arhat","array","(","[","[","[","1.",",","0",".","]",",","[","0.",",","1",".","]","]",",","[","[","-0.77784898",",","0.01726193","]",",","[","0.10733009",",","-0.78665335","]","]","]",")"]
docstr: estimate parameters using ols
  
  Parameters
  ----------
  nlags : int
      number of lags to include in regression, same for all variables
  
  Returns
  -------
  None, but attaches
  
  arhat : array (nlags, nvar, nvar)
      full lag polynomial array
  arlhs : array (nlags-1, nvar, nvar)
      reduced lag polynomial for left hand side
  other statistics as returned by linalg.lstsq : need to be completed
  
  
  
  This currently assumes all parameters are estimated without restrictions.
  In this case SUR is identical to OLS
  
  estimation results are attached to the class instance
docstr_tok: ["estimate","parameters","using","ols","Parameters","--","--","--","--","--","nlags",":","int","number","of","lags","to","include","in","regression",",","same","for","all","variables","Returns","--","--","--","-","None",",","but","attaches","arhat",":","array","(","nlags",",","nvar",",","nvar",")","full","lag","polynomial","array","arlhs",":","array","(","nlags-1",",","nvar",",","nvar",")","reduced","lag","polynomial","for","left","hand","side","other","statistics","as","returned","by","linalg.lstsq",":","need","to","be","completed","This","currently","assumes","all","parameters","are","estimated","without","restrictions",".","In","this","case","SUR","is","identical","to","OLS","estimation","results","are","attached","to","the","class","instance"]
code: def fit(self, nlags):
      """estimate parameters using ols
  
      Parameters
      ----------
      nlags : int
          number of lags to include in regression, same for all variables
  
      Returns
      -------
      None, but attaches
  
      arhat : array (nlags, nvar, nvar)
          full lag polynomial array
      arlhs : array (nlags-1, nvar, nvar)
          reduced lag polynomial for left hand side
      other statistics as returned by linalg.lstsq : need to be completed
  
  
  
      This currently assumes all parameters are estimated without restrictions.
      In this case SUR is identical to OLS
  
      estimation results are attached to the class instance
  
  
      """
      self.nlags = nlags  # without current period
      nvars = self.nvars
      # TODO: ar2s looks like a module variable, bug?
      # lmat = lagmat(ar2s, nlags, trim='both', original='in')
      lmat = lagmat(self.y, nlags, trim="both", original="in")
      self.yred = lmat[:, :nvars]
      self.xred = lmat[:, nvars:]
      res = np.linalg.lstsq(self.xred, self.yred, rcond=-1)
      self.estresults = res
      self.arlhs = res[0].reshape(nlags, nvars, nvars)
      self.arhat = ar2full(self.arlhs)
      self.rss = res[1]
      self.xredrank = res[2]
  
imports: import numpy
  from scipy import signal
  from statsmodels.tsa.tsatools import lagmat
label_desc: Use image node_id 2 for calling the _Var obj's underlying member method code with example usage: obj.fit(nlags) without return types