class_docstr: Fit VAR and then estimate structural components of A and B, defined:
  
  .. math:: Ay_t = A_1 y_{t-1} + \ldots + A_p y_{t-p} + B\var(\epsilon_t)
  
  Parameters
  ----------
  endog : array_like
      1-d endogenous response variable. The independent variable.
  dates : array_like
      must match number of rows of endog
  svar_type : str
      "A" - estimate structural parameters of A matrix, B assumed = I
      "B" - estimate structural parameters of B matrix, A assumed = I
      "AB" - estimate structural parameters indicated in both A and B matrix
  A : array_like
      neqs x neqs with unknown parameters marked with 'E' for estimate
  B : array_like
      neqs x neqs with unknown parameters marked with 'E' for estimate
  
  References
  ----------
  Hamilton (1994) Time Series Analysis
class_docstr_tok: ["Fit","VAR","and","then","estimate","structural","components","of","A","and","B",",","defined",":","..","math",":",":","Ay_t","=","A_1","y_","{","t-1","}","+","\\ldots","+","A_p","y_","{","t-p","}","+","B\\var","(","\\epsilon_t",")","Parameters","--","--","--","--","--","endog",":","array_like","1-d","endogenous","response","variable",".","The","independent","variable",".","dates",":","array_like","must","match","number","of","rows","of","endog","svar_type",":","str","``","A","''","-","estimate","structural","parameters","of","A","matrix",",","B","assumed","=","I","``","B","''","-","estimate","structural","parameters","of","B","matrix",",","A","assumed","=","I","``","AB","''","-","estimate","structural","parameters","indicated","in","both","A","and","B","matrix","A",":","array_like","neqs","x","neqs","with","unknown","parameters","marked","with","'","E","'","for","estimate","B",":","array_like","neqs","x","neqs","with","unknown","parameters","marked","with","'","E","'","for","estimate","References","--","--","--","--","--","Hamilton","(","1994",")","Time","Series","Analysis"]
docstr: lags : int
  trend : {str, None}
      As per above
docstr_tok: ["lags",":","int","trend",":","{","str",",","None","}","As","per","above"]
code: def _estimate_svar(
      self,
      start_params,
      lags,
      maxiter,
      maxfun,
      trend="c",
      solver="nm",
      override=False,
  ):
      """
      lags : int
      trend : {str, None}
          As per above
      """
      k_trend = util.get_trendorder(trend)
      y = self.endog
      z = util.get_var_endog(y, lags, trend=trend, has_constant="raise")
      y_sample = y[lags:]
  
      # Lutkepohl p75, about 5x faster than stated formula
      var_params = np.linalg.lstsq(z, y_sample, rcond=-1)[0]
      resid = y_sample - np.dot(z, var_params)
  
      # Unbiased estimate of covariance matrix $\Sigma_u$ of the white noise
      # process $u$
      # equivalent definition
      # .. math:: \frac{1}{T - Kp - 1} Y^\prime (I_T - Z (Z^\prime Z)^{-1}
      # Z^\prime) Y
      # Ref: Lutkepohl p.75
      # df_resid right now is T - Kp - 1, which is a suggested correction
  
      avobs = len(y_sample)
  
      df_resid = avobs - (self.neqs * lags + k_trend)
  
      sse = np.dot(resid.T, resid)
      # TODO: should give users the option to use a dof correction or not
      omega = sse / df_resid
      self.sigma_u = omega
  
      A, B = self._solve_AB(
          start_params,
          override=override,
          solver=solver,
          maxiter=maxiter,
      )
      A_mask = self.A_mask
      B_mask = self.B_mask
  
      return SVARResults(
          y,
          z,
          var_params,
          omega,
          lags,
          names=self.endog_names,
          trend=trend,
          dates=self.data.dates,
          model=self,
          A=A,
          B=B,
          A_mask=A_mask,
          B_mask=B_mask,
      )
  
imports: import numpy
  import numpy.linalg
  from numpy.linalg import slogdet
  from statsmodels.tools.decorators import deprecated_alias
  from statsmodels.tools.numdiff import approx_fprime, approx_hess
  import statsmodels.tsa.base.tsa_model
  from statsmodels.tsa.vector_ar.irf import IRAnalysis
  import statsmodels.tsa.vector_ar.util
  from statsmodels.tsa.vector_ar.var_model import VARProcess, VARResults
label_desc: Use image node_id 4 for calling the SVAR obj's underlying member method code with example usage: obj._estimate_svar(start_params, lags, maxiter, maxfun, trend, solver, override) and returns: SVARResults