class_docstr: State space representation of a time series process
  
  Parameters
  ----------
  k_endog : {array_like, int}
      The observed time-series process :math:`y` if array like or the
      number of variables in the process if an integer.
  k_states : int
      The dimension of the unobserved state process.
  k_posdef : int, optional
      The dimension of a guaranteed positive definite covariance matrix
      describing the shocks in the measurement equation. Must be less than
      or equal to `k_states`. Default is `k_states`.
  initial_variance : float, optional
      Initial variance used when approximate diffuse initialization is
      specified. Default is 1e6.
  initialization : Initialization object or str, optional
      Initialization method for the initial state. If a string, must be one
      of {'diffuse', 'approximate_diffuse', 'stationary', 'known'}.
  initial_state : array_like, optional
      If `initialization='known'` is used, the mean of the initial state's
      distribution.
  initial_state_cov : array_like, optional
      If `initialization='known'` is used, the covariance matrix of the
      initial state's distribution.
  nobs : int, optional
      If an endogenous vector is not given (i.e. `k_endog` is an integer),
      the number of observations can optionally be specified. If not
      specified, they will be set to zero until data is bound to the model.
  dtype : np.dtype, optional
      If an endogenous vector is not given (i.e. `k_endog` is an integer),
      the default datatype of the state space matrices can optionally be
      specified. Default is `np.float64`.
  design : array_like, optional
      The design matrix, :math:`Z`. Default is set to zeros.
  obs_intercept : array_like, optional
      The intercept for the observation equation, :math:`d`. Default is set
      to zeros.
  obs_cov : array_like, optional
      The covariance matrix for the observation equation :math:`H`. Default
      is set to zeros.
  transition : array_like, optional
      The transition matrix, :math:`T`. Default is set to zeros.
  state_intercept : array_like, optional
      The intercept for the transition equation, :math:`c`. Default is set to
      zeros.
  selection : array_like, optional
      The selection matrix, :math:`R`. Default is set to zeros.
  state_cov : array_like, optional
      The covariance matrix for the state equation :math:`Q`. Default is set
      to zeros.
  **kwargs
      Additional keyword arguments. Not used directly. It is present to
      improve compatibility with subclasses, so that they can use `**kwargs`
      to specify any default state space matrices (e.g. `design`) without
      having to clean out any other keyword arguments they might have been
      passed.
  
  Attributes
  ----------
  nobs : int
      The number of observations.
  k_endog : int
      The dimension of the observation series.
  k_states : int
      The dimension of the unobserved state process.
  k_posdef : int
      The dimension of a guaranteed positive
      definite covariance matrix describing
      the shocks in the measurement equation.
  shapes : dictionary of name:tuple
      A dictionary recording the initial shapes
      of each of the representation matrices as
      tuples.
  initialization : str
      Kalman filter initialization method. Default is unset.
  initial_variance : float
      Initial variance for approximate diffuse
      initialization. Default is 1e6.
  
  Notes
  -----
  A general state space model is of the form
  
  .. math::
  
      y_t & = Z_t \alpha_t + d_t + \varepsilon_t \\
      \alpha_t & = T_t \alpha_{t-1} + c_t + R_t \eta_t \\
  
  where :math:`y_t` refers to the observation vector at time :math:`t`,
  :math:`\alpha_t` refers to the (unobserved) state vector at time
  :math:`t`, and where the irregular components are defined as
  
  .. math::
  
      \varepsilon_t \sim N(0, H_t) \\
      \eta_t \sim N(0, Q_t) \\
  
  The remaining variables (:math:`Z_t, d_t, H_t, T_t, c_t, R_t, Q_t`) in the
  equations are matrices describing the process. Their variable names and
  dimensions are as follows
  
  Z : `design`          :math:`(k\_endog \times k\_states \times nobs)`
  
  d : `obs_intercept`   :math:`(k\_endog \times nobs)`
  
  H : `obs_cov`         :math:`(k\_endog \times k\_endog \times nobs)`
  
  T : `transition`      :math:`(k\_states \times k\_states \times nobs)`
  
  c : `state_intercept` :math:`(k\_states \times nobs)`
  
  R : `selection`       :math:`(k\_states \times k\_posdef \times nobs)`
  
  Q : `state_cov`       :math:`(k\_posdef \times k\_posdef \times nobs)`
  
  In the case that one of the matrices is time-invariant (so that, for
  example, :math:`Z_t = Z_{t+1} ~ \forall ~ t`), its last dimension may
  be of size :math:`1` rather than size `nobs`.
  
  References
  ----------
  .. [*] Durbin, James, and Siem Jan Koopman. 2012.
     Time Series Analysis by State Space Methods: Second Edition.
     Oxford University Press.
class_docstr_tok: ["State","space","representation","of","a","time","series","process","Parameters","--","--","--","--","--","k_endog",":","{","array_like",",","int","}","The","observed","time-series","process",":","math",":","`","y","`","if","array","like","or","the","number","of","variables","in","the","process","if","an","integer",".","k_states",":","int","The","dimension","of","the","unobserved","state","process",".","k_posdef",":","int",",","optional","The","dimension","of","a","guaranteed","positive","definite","covariance","matrix","describing","the","shocks","in","the","measurement","equation",".","Must","be","less","than","or","equal","to","`","k_states","`",".","Default","is","`","k_states","`",".","initial_variance",":","float",",","optional","Initial","variance","used","when","approximate","diffuse","initialization","is","specified",".","Default","is","1e6",".","initialization",":","Initialization","object","or","str",",","optional","Initialization","method","for","the","initial","state",".","If","a","string",",","must","be","one","of","{","'diffuse","'",",","'approximate_diffuse","'",",","'stationary","'",",","'known","'","}",".","initial_state",":","array_like",",","optional","If","`","initialization='known","'","`","is","used",",","the","mean","of","the","initial","state's","distribution",".","initial_state_cov",":","array_like",",","optional","If","`","initialization='known","'","`","is","used",",","the","covariance","matrix","of","the","initial","state","'s","distribution",".","nobs",":","int",",","optional","If","an","endogenous","vector","is","not","given","(","i.e",".","`","k_endog","`","is","an","integer",")",",","the","number","of","observations","can","optionally","be","specified",".","If","not","specified",",","they","will","be","set","to","zero","until","data","is","bound","to","the","model",".","dtype",":","np.dtype",",","optional","If","an","endogenous","vector","is","not","given","(","i.e",".","`","k_endog","`","is","an","integer",")",",","the","default","datatype","of","the","state","space","matrices","can","optionally","be","specified",".","Default","is","`","np.float64","`",".","design",":","array_like",",","optional","The","design","matrix",",",":","math",":","`","Z","`",".","Default","is","set","to","zeros",".","obs_intercept",":","array_like",",","optional","The","intercept","for","the","observation","equation",",",":","math",":","`","d","`",".","Default","is","set","to","zeros",".","obs_cov",":","array_like",",","optional","The","covariance","matrix","for","the","observation","equation",":","math",":","`","H","`",".","Default","is","set","to","zeros",".","transition",":","array_like",",","optional","The","transition","matrix",",",":","math",":","`","T","`",".","Default","is","set","to","zeros",".","state_intercept",":","array_like",",","optional","The","intercept","for","the","transition","equation",",",":","math",":","`","c","`",".","Default","is","set","to","zeros",".","selection",":","array_like",",","optional","The","selection","matrix",",",":","math",":","`","R","`",".","Default","is","set","to","zeros",".","state_cov",":","array_like",",","optional","The","covariance","matrix","for","the","state","equation",":","math",":","`","Q","`",".","Default","is","set","to","zeros",".","*","*","kwargs","Additional","keyword","arguments",".","Not","used","directly",".","It","is","present","to","improve","compatibility","with","subclasses",",","so","that","they","can","use","`","*","*","kwargs","`","to","specify","any","default","state","space","matrices","(","e.g",".","`","design","`",")","without","having","to","clean","out","any","other","keyword","arguments","they","might","have","been","passed",".","Attributes","--","--","--","--","--","nobs",":","int","The","number","of","observations",".","k_endog",":","int","The","dimension","of","the","observation","series",".","k_states",":","int","The","dimension","of","the","unobserved","state","process",".","k_posdef",":","int","The","dimension","of","a","guaranteed","positive","definite","covariance","matrix","describing","the","shocks","in","the","measurement","equation",".","shapes",":","dictionary","of","name",":","tuple","A","dictionary","recording","the","initial","shapes","of","each","of","the","representation","matrices","as","tuples",".","initialization",":","str","Kalman","filter","initialization","method",".","Default","is","unset",".","initial_variance",":","float","Initial","variance","for","approximate","diffuse","initialization",".","Default","is","1e6",".","Notes","--","--","-","A","general","state","space","model","is","of","the","form","..","math",":",":","y_t","&","=","Z_t","\\alpha_t","+","d_t","+","\\varepsilon_t","\\\\","\\alpha_t","&","=","T_t","\\alpha_","{","t-1","}","+","c_t","+","R_t","\\eta_t","\\\\","where",":","math",":","`","y_t","`","refers","to","the","observation","vector","at","time",":","math",":","`","t","`",",",":","math",":","`","\\alpha_t","`","refers","to","the","(","unobserved",")","state","vector","at","time",":","math",":","`","t","`",",","and","where","the","irregular","components","are","defined","as","..","math",":",":","\\varepsilon_t","\\sim","N","(","0",",","H_t",")","\\\\","\\eta_t","\\sim","N","(","0",",","Q_t",")","\\\\","The","remaining","variables","(",":","math",":","`","Z_t",",","d_t",",","H_t",",","T_t",",","c_t",",","R_t",",","Q_t","`",")","in","the","equations","are","matrices","describing","the","process",".","Their","variable","names","and","dimensions","are","as","follows","Z",":","`","design","`",":","math",":","`","(","k\\_endog","\\times","k\\_states","\\times","nobs",")","`","d",":","`","obs_intercept","`",":","math",":","`","(","k\\_endog","\\times","nobs",")","`","H",":","`","obs_cov","`",":","math",":","`","(","k\\_endog","\\times","k\\_endog","\\times","nobs",")","`","T",":","`","transition","`",":","math",":","`","(","k\\_states","\\times","k\\_states","\\times","nobs",")","`","c",":","`","state_intercept","`",":","math",":","`","(","k\\_states","\\times","nobs",")","`","R",":","`","selection","`",":","math",":","`","(","k\\_states","\\times","k\\_posdef","\\times","nobs",")","`","Q",":","`","state_cov","`",":","math",":","`","(","k\\_posdef","\\times","k\\_posdef","\\times","nobs",")","`","In","the","case","that","one","of","the","matrices","is","time-invariant","(","so","that",",","for","example",",",":","math",":","`","Z_t","=","Z_","{","t+1","}","~","\\forall","~","t","`",")",",","its","last","dimension","may","be","of","size",":","math",":","`","1","`","rather","than","size","`","nobs","`",".","References","--","--","--","--","--","..","[","*","]","Durbin",",","James",",","and","Siem","Jan","Koopman",".","2012",".","Time","Series","Analysis","by","State","Space","Methods",":","Second","Edition",".","Oxford","University","Press","."]
docstr: Initialize the statespace model with component matrices
  
  Parameters
  ----------
  a : array_like, optional
      Vector of constant values describing the mean of the stationary
      component of the initial state.
  Pstar : array_like, optional
      Stationary component of the initial state covariance matrix. If
      given, should be a matrix shaped `k_states x k_states`. The
      submatrix associated with the diffuse states should contain zeros.
      Note that by definition, `Pstar = R0 @ Q0 @ R0.T`, so either
      `R0,Q0` or `Pstar` may be given, but not both.
  Pinf : array_like, optional
      Diffuse component of the initial state covariance matrix. If given,
      should be a matrix shaped `k_states x k_states` with ones in the
      diagonal positions corresponding to states with diffuse
      initialization and zeros otherwise. Note that by definition,
      `Pinf = A @ A.T`, so either `A` or `Pinf` may be given, but not
      both.
  A : array_like, optional
      Diffuse selection matrix, used in the definition of the diffuse
      initial state covariance matrix. If given, should be a
      `k_states x k_diffuse_states` matrix that contains the subset of
      the columns of the identity matrix that correspond to states with
      diffuse initialization. Note that by definition, `Pinf = A @ A.T`,
      so either `A` or `Pinf` may be given, but not both.
  R0 : array_like, optional
      Stationary selection matrix, used in the definition of the
      stationary initial state covariance matrix. If given, should be a
      `k_states x k_nondiffuse_states` matrix that contains the subset of
      the columns of the identity matrix that correspond to states with a
      non-diffuse initialization. Note that by definition,
      `Pstar = R0 @ Q0 @ R0.T`, so either `R0,Q0` or `Pstar` may be
      given, but not both.
  Q0 : array_like, optional
      Covariance matrix associated with stationary initial states. If
      given, should be a matrix shaped
      `k_nondiffuse_states x k_nondiffuse_states`.
      Note that by definition, `Pstar = R0 @ Q0 @ R0.T`, so either
      `R0,Q0` or `Pstar` may be given, but not both.
  
  Notes
  -----
  The matrices `a, Pstar, Pinf, A, R0, Q0` and the process for
  initializing the state space model is as given in Chapter 5 of [1]_.
  For the definitions of these matrices, see equation (5.2) and the
  subsequent discussion there.
  
  References
  ----------
  .. [1] Durbin, James, and Siem Jan Koopman. 2012.
     Time Series Analysis by State Space Methods: Second Edition.
     Oxford University Press.
docstr_tok: ["Initialize","the","statespace","model","with","component","matrices","Parameters","--","--","--","--","--","a",":","array_like",",","optional","Vector","of","constant","values","describing","the","mean","of","the","stationary","component","of","the","initial","state",".","Pstar",":","array_like",",","optional","Stationary","component","of","the","initial","state","covariance","matrix",".","If","given",",","should","be","a","matrix","shaped","`","k_states","x","k_states","`",".","The","submatrix","associated","with","the","diffuse","states","should","contain","zeros",".","Note","that","by","definition",",","`","Pstar","=","R0","@","Q0","@","R0.T","`",",","so","either","`","R0",",","Q0","`","or","`","Pstar","`","may","be","given",",","but","not","both",".","Pinf",":","array_like",",","optional","Diffuse","component","of","the","initial","state","covariance","matrix",".","If","given",",","should","be","a","matrix","shaped","`","k_states","x","k_states","`","with","ones","in","the","diagonal","positions","corresponding","to","states","with","diffuse","initialization","and","zeros","otherwise",".","Note","that","by","definition",",","`","Pinf","=","A","@","A.T","`",",","so","either","`","A","`","or","`","Pinf","`","may","be","given",",","but","not","both",".","A",":","array_like",",","optional","Diffuse","selection","matrix",",","used","in","the","definition","of","the","diffuse","initial","state","covariance","matrix",".","If","given",",","should","be","a","`","k_states","x","k_diffuse_states","`","matrix","that","contains","the","subset","of","the","columns","of","the","identity","matrix","that","correspond","to","states","with","diffuse","initialization",".","Note","that","by","definition",",","`","Pinf","=","A","@","A.T","`",",","so","either","`","A","`","or","`","Pinf","`","may","be","given",",","but","not","both",".","R0",":","array_like",",","optional","Stationary","selection","matrix",",","used","in","the","definition","of","the","stationary","initial","state","covariance","matrix",".","If","given",",","should","be","a","`","k_states","x","k_nondiffuse_states","`","matrix","that","contains","the","subset","of","the","columns","of","the","identity","matrix","that","correspond","to","states","with","a","non-diffuse","initialization",".","Note","that","by","definition",",","`","Pstar","=","R0","@","Q0","@","R0.T","`",",","so","either","`","R0",",","Q0","`","or","`","Pstar","`","may","be","given",",","but","not","both",".","Q0",":","array_like",",","optional","Covariance","matrix","associated","with","stationary","initial","states",".","If","given",",","should","be","a","matrix","shaped","`","k_nondiffuse_states","x","k_nondiffuse_states","`",".","Note","that","by","definition",",","`","Pstar","=","R0","@","Q0","@","R0.T","`",",","so","either","`","R0",",","Q0","`","or","`","Pstar","`","may","be","given",",","but","not","both",".","Notes","--","--","-","The","matrices","`","a",",","Pstar",",","Pinf",",","A",",","R0",",","Q0","`","and","the","process","for","initializing","the","state","space","model","is","as","given","in","Chapter","5","of","[","1","]","_",".","For","the","definitions","of","these","matrices",",","see","equation","(","5.2",")","and","the","subsequent","discussion","there",".","References","--","--","--","--","--","..","[","1","]","Durbin",",","James",",","and","Siem","Jan","Koopman",".","2012",".","Time","Series","Analysis","by","State","Space","Methods",":","Second","Edition",".","Oxford","University","Press","."]
code: def initialize_components(
      self, a=None, Pstar=None, Pinf=None, A=None, R0=None, Q0=None
  ):
      """
      Initialize the statespace model with component matrices
  
      Parameters
      ----------
      a : array_like, optional
          Vector of constant values describing the mean of the stationary
          component of the initial state.
      Pstar : array_like, optional
          Stationary component of the initial state covariance matrix. If
          given, should be a matrix shaped `k_states x k_states`. The
          submatrix associated with the diffuse states should contain zeros.
          Note that by definition, `Pstar = R0 @ Q0 @ R0.T`, so either
          `R0,Q0` or `Pstar` may be given, but not both.
      Pinf : array_like, optional
          Diffuse component of the initial state covariance matrix. If given,
          should be a matrix shaped `k_states x k_states` with ones in the
          diagonal positions corresponding to states with diffuse
          initialization and zeros otherwise. Note that by definition,
          `Pinf = A @ A.T`, so either `A` or `Pinf` may be given, but not
          both.
      A : array_like, optional
          Diffuse selection matrix, used in the definition of the diffuse
          initial state covariance matrix. If given, should be a
          `k_states x k_diffuse_states` matrix that contains the subset of
          the columns of the identity matrix that correspond to states with
          diffuse initialization. Note that by definition, `Pinf = A @ A.T`,
          so either `A` or `Pinf` may be given, but not both.
      R0 : array_like, optional
          Stationary selection matrix, used in the definition of the
          stationary initial state covariance matrix. If given, should be a
          `k_states x k_nondiffuse_states` matrix that contains the subset of
          the columns of the identity matrix that correspond to states with a
          non-diffuse initialization. Note that by definition,
          `Pstar = R0 @ Q0 @ R0.T`, so either `R0,Q0` or `Pstar` may be
          given, but not both.
      Q0 : array_like, optional
          Covariance matrix associated with stationary initial states. If
          given, should be a matrix shaped
          `k_nondiffuse_states x k_nondiffuse_states`.
          Note that by definition, `Pstar = R0 @ Q0 @ R0.T`, so either
          `R0,Q0` or `Pstar` may be given, but not both.
  
      Notes
      -----
      The matrices `a, Pstar, Pinf, A, R0, Q0` and the process for
      initializing the state space model is as given in Chapter 5 of [1]_.
      For the definitions of these matrices, see equation (5.2) and the
      subsequent discussion there.
  
      References
      ----------
      .. [1] Durbin, James, and Siem Jan Koopman. 2012.
         Time Series Analysis by State Space Methods: Second Edition.
         Oxford University Press.
      """
      self.initialize(
          "components", a=a, Pstar=Pstar, Pinf=Pinf, A=A, R0=R0, Q0=Q0
      )
  
imports: import warnings
  import numpy
  from .tools import find_best_blas_type, validate_matrix_shape, validate_vector_shape
  from .initialization import Initialization
  from .None import tools
label_desc: Use image node_id 17 for calling the Representation obj's underlying member method code with example usage: obj.initialize_components(a, Pstar, Pinf, A, R0, Q0) without return types