code: def test_unobserved_components(missing, periods, use_exact_diffuse):
      endog = np.array([0.5, 1.2, -0.2, 0.3, -0.1, 0.4, 1.4, 0.9])
      exog = np.ones_like(endog)
      if missing == "init":
          endog[0:2] = np.nan
      elif missing == "mixed":
          endog[2:4] = np.nan
      elif missing == "all":
          endog[:] = np.nan
  
      mod = structural.UnobservedComponents(
          endog,
          "llevel",
          exog=exog,
          seasonal=2,
          autoregressive=1,
          use_exact_diffuse=use_exact_diffuse,
      )
      mod.update([1.0, 0.1, 0.3, 0.05, 0.15, 0.5])
      check_filter_output(mod, periods)
      check_smoother_output(mod, periods)
  
file_path: statsmodels/statsmodels/tsa/statespace/tests/test_multivariate_switch_univariate.py
imports: import numpy
  import pytest
  from statsmodels.tsa.statespace import mlemodel, sarimax, structural, varmax, dynamic_factor
  from statsmodels.tsa.statespace.tests.test_impulse_responses import TVSS
  from numpy.testing import assert_allclose
label_desc: Use image node_id 9 for calling a global function with example usage: test_unobserved_components(missing, periods, use_exact_diffuse) without return types