class_docstr: AR(1) model for monthly growth rates aggregated to quarterly frequency
  
  Parameters
  ----------
  endog : array_like
      The observed time-series process :math:`y`
  
  Notes
  -----
  This model is internal, used to estimate starting parameters for the
  DynamicFactorMQ class. The model is:
  
  .. math::
  
      y_t & = \begin{bmatrix} 1 & 2 & 3 & 2 & 1 \end{bmatrix} \alpha_t \\
      \alpha_t & = \begin{bmatrix}
          \phi & 0 & 0 & 0 & 0 \\
             1 & 0 & 0 & 0 & 0 \\
             0 & 1 & 0 & 0 & 0 \\
             0 & 0 & 1 & 0 & 0 \\
             0 & 0 & 0 & 1 & 0 \\
      \end{bmatrix} +
      \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \\ 0 \end{bmatrix} \varepsilon_t
  
  The two parameters to be estimated are :math:`\phi` and :math:`\sigma^2`.
  
  It supports fitting via the usual quasi-Newton methods, as well as using
  the EM algorithm.
class_docstr_tok: ["AR","(","1",")","model","for","monthly","growth","rates","aggregated","to","quarterly","frequency","Parameters","--","--","--","--","--","endog",":","array_like","The","observed","time-series","process",":","math",":","`","y","`","Notes","--","--","-","This","model","is","internal",",","used","to","estimate","starting","parameters","for","the","DynamicFactorMQ","class",".","The","model","is",":","..","math",":",":","y_t","&","=","\\begin","{","bmatrix","}","1","&","2","&","3","&","2","&","1","\\end","{","bmatrix","}","\\alpha_t","\\\\","\\alpha_t","&","=","\\begin","{","bmatrix","}","\\phi","&","0","&","0","&","0","&","0","\\\\","1","&","0","&","0","&","0","&","0","\\\\","0","&","1","&","0","&","0","&","0","\\\\","0","&","0","&","1","&","0","&","0","\\\\","0","&","0","&","0","&","1","&","0","\\\\","\\end","{","bmatrix","}","+","\\begin","{","bmatrix","}","1","\\\\","0","\\\\","0","\\\\","0","\\\\","0","\\end","{","bmatrix","}","\\varepsilon_t","The","two","parameters","to","be","estimated","are",":","math",":","`","\\phi","`","and",":","math",":","`","\\sigma^2","`",".","It","supports","fitting","via","the","usual","quasi-Newton","methods",",","as","well","as","using","the","EM","algorithm","."]
code: def fit_em(
      self,
      start_params=None,
      transformed=True,
      cov_type="none",
      cov_kwds=None,
      maxiter=500,
      tolerance=1e-6,
      em_initialization=True,
      mstep_method=None,
      full_output=True,
      return_params=False,
      low_memory=False,
  ):
      if self._has_fixed_params:
          raise NotImplementedError(
              "Cannot fit using the EM algorithm while"
              " holding some parameters fixed."
          )
      if low_memory:
          raise ValueError(
              "Cannot fit using the EM algorithm when using"
              " low_memory option."
          )
  
      if start_params is None:
          start_params = self.start_params
          transformed = True
      else:
          start_params = np.array(start_params, ndmin=1)
  
      if not transformed:
          start_params = self.transform_params(start_params)
  
      # Perform expectation-maximization
      llf = []
      params = [start_params]
      init = None
      i = 0
      delta = 0
      while i < maxiter and (i < 2 or (delta > tolerance)):
          out = self._em_iteration(
              params[-1], init=init, mstep_method=mstep_method
          )
          llf.append(out[0].llf_obs.sum())
          params.append(out[1])
          if em_initialization:
              init = initialization.Initialization(
                  self.k_states,
                  "known",
                  constant=out[0].smoothed_state[..., 0],
                  stationary_cov=out[0].smoothed_state_cov[..., 0],
              )
          if i > 0:
              delta = (
                  2
                  * (llf[-1] - llf[-2])
                  / (np.abs(llf[-1]) + np.abs(llf[-2]))
              )
          i += 1
  
      # Just return the fitted parameters if requested
      if return_params:
          result = params[-1]
      # Otherwise construct the results class if desired
      else:
          if em_initialization:
              base_init = self.ssm.initialization
              self.ssm.initialization = init
          result = self.smooth(
              params[-1],
              transformed=True,
              cov_type=cov_type,
              cov_kwds=cov_kwds,
          )
          if em_initialization:
              self.ssm.initialization = base_init
  
          # Save the output
          if full_output:
              em_retvals = Bunch(
                  **{
                      "params": np.array(params),
                      "llf": np.array(llf),
                      "iter": i,
                  }
              )
              em_settings = Bunch(
                  **{"tolerance": tolerance, "maxiter": maxiter}
              )
          else:
              em_retvals = None
              em_settings = None
  
          result.mle_retvals = em_retvals
          result.mle_settings = em_settings
  
      return result
  
file_path: statsmodels/statsmodels/tsa/statespace/_quarterly_ar1.py
imports: import warnings
  import numpy
  from statsmodels.tools.tools import Bunch
  from statsmodels.tsa.statespace import mlemodel, initialization
  from statsmodels.tsa.statespace.kalman_smoother import SMOOTHER_STATE, SMOOTHER_STATE_COV, SMOOTHER_STATE_AUTOCOV
  from statsmodels.tsa.statespace.tools import constrain_stationary_univariate, unconstrain_stationary_univariate
label_desc: Use image node_id 5 for calling the QuarterlyAR1 obj's underlying member method code with example usage: obj.fit_em(start_params, transformed, cov_type, cov_kwds, maxiter, tolerance, em_initialization, mstep_method, full_output, return_params, low_memory) and returns: result