class_docstr: Recursive least squares
  
  Parameters
  ----------
  endog : array_like
      The observed time-series process :math:`y`
  exog : array_like
      Array of exogenous regressors, shaped nobs x k.
  constraints : array_like, str, or tuple
          - array : An r x k array where r is the number of restrictions to
            test and k is the number of regressors. It is assumed that the
            linear combination is equal to zero.
          - str : The full hypotheses to test can be given as a string.
            See the examples.
          - tuple : A tuple of arrays in the form (R, q), ``q`` can be
            either a scalar or a length p row vector.
  
  Notes
  -----
  Recursive least squares (RLS) corresponds to expanding window ordinary
  least squares (OLS).
  
  This model applies the Kalman filter to compute recursive estimates of the
  coefficients and recursive residuals.
  
  References
  ----------
  .. [*] Durbin, James, and Siem Jan Koopman. 2012.
     Time Series Analysis by State Space Methods: Second Edition.
     Oxford University Press.
class_docstr_tok: ["Recursive","least","squares","Parameters","--","--","--","--","--","endog",":","array_like","The","observed","time-series","process",":","math",":","`","y","`","exog",":","array_like","Array","of","exogenous","regressors",",","shaped","nobs","x","k.","constraints",":","array_like",",","str",",","or","tuple","-","array",":","An","r","x","k","array","where","r","is","the","number","of","restrictions","to","test","and","k","is","the","number","of","regressors",".","It","is","assumed","that","the","linear","combination","is","equal","to","zero",".","-","str",":","The","full","hypotheses","to","test","can","be","given","as","a","string",".","See","the","examples",".","-","tuple",":","A","tuple","of","arrays","in","the","form","(","R",",","q",")",",","``","q","``","can","be","either","a","scalar","or","a","length","p","row","vector",".","Notes","--","--","-","Recursive","least","squares","(","RLS",")","corresponds","to","expanding","window","ordinary","least","squares","(","OLS",")",".","This","model","applies","the","Kalman","filter","to","compute","recursive","estimates","of","the","coefficients","and","recursive","residuals",".","References","--","--","--","--","--","..","[","*","]","Durbin",",","James",",","and","Siem","Jan","Koopman",".","2012",".","Time","Series","Analysis","by","State","Space","Methods",":","Second","Edition",".","Oxford","University","Press","."]
code: def __init__(self, endog, exog, constraints=None, **kwargs):
      # Standardize data
      endog_using_pandas = _is_using_pandas(endog, None)
      if not endog_using_pandas:
          endog = np.asanyarray(endog)
  
      exog_is_using_pandas = _is_using_pandas(exog, None)
      if not exog_is_using_pandas:
          exog = np.asarray(exog)
  
      # Make sure we have 2-dimensional array
      if exog.ndim == 1:
          if not exog_is_using_pandas:
              exog = exog[:, None]
          else:
              exog = pd.DataFrame(exog)
  
      self.k_exog = exog.shape[1]
  
      # Handle constraints
      self.k_constraints = 0
      self._r_matrix = self._q_matrix = None
      if constraints is not None:
          from patsy import DesignInfo
          from statsmodels.base.data import handle_data
  
          data = handle_data(endog, exog, **kwargs)
          names = data.param_names
          LC = DesignInfo(names).linear_constraint(constraints)
          self._r_matrix, self._q_matrix = LC.coefs, LC.constants
          self.k_constraints = self._r_matrix.shape[0]
  
          nobs = len(endog)
          constraint_endog = np.zeros((nobs, len(self._r_matrix)))
          if endog_using_pandas:
              constraint_endog = pd.DataFrame(
                  constraint_endog, index=endog.index
              )
              endog = concat([endog, constraint_endog], axis=1)
              # Complexity needed to handle multiple version of pandas
              # Pandas >= 2 can use endog.iloc[:, 1:] = self._q_matrix.T
              endog.iloc[:, 1:] = np.tile(self._q_matrix.T, (nobs, 1))
          else:
              endog[:, 1:] = self._q_matrix[:, 0]
  
      # Handle coefficient initialization
      kwargs.setdefault("initialization", "diffuse")
  
      # Remove some formula-specific kwargs
      formula_kwargs = [
          "missing",
          "missing_idx",
          "formula",
          "design_info",
      ]
      for name in formula_kwargs:
          if name in kwargs:
              del kwargs[name]
  
      # Initialize the state space representation
      super().__init__(endog, k_states=self.k_exog, exog=exog, **kwargs)
  
      # Use univariate filtering by default
      self.ssm.filter_univariate = True
  
      # Concentrate the scale out of the likelihood function
      self.ssm.filter_concentrated = True
  
      # Setup the state space representation
      self["design"] = np.zeros(
          (self.k_endog, self.k_states, self.nobs)
      )
      self["design", 0] = self.exog[:, :, None].T
      if self._r_matrix is not None:
          self["design", 1:, :] = self._r_matrix[:, :, None]
      self["transition"] = np.eye(self.k_states)
  
      # Notice that the filter output does not depend on the measurement
      # variance, so we set it here to 1
      self["obs_cov", 0, 0] = 1.0
      self["transition"] = np.eye(self.k_states)
  
      # Linear constraints are technically imposed by adding "fake" endog
      # variables that are used during filtering, but for all model- and
      # results-based purposes we want k_endog = 1.
      if self._r_matrix is not None:
          self.k_endog = 1
  
imports: import numpy
  import pandas
  from statsmodels.compat.pandas import Appender
  from statsmodels.tools.data import _is_using_pandas
  from statsmodels.tsa.statespace.mlemodel import MLEModel, MLEResults, MLEResultsWrapper, PredictionResults, PredictionResultsWrapper
  from statsmodels.tsa.statespace.tools import concat
  from statsmodels.tools.tools import Bunch
  from statsmodels.tools.decorators import cache_readonly
  import statsmodels.base.wrapper
label_desc: Use image node_id 1 to create a new RecursiveLS object from inherited base classes: MLEModel with example: obj = RecursiveLS(endog, exog, constraints)