code: def test_misc_exog():
      # Tests for missing data
      nobs = 20
      k_endog = 1
      np.random.seed(1208)
      endog = np.random.normal(size=(nobs, k_endog))
      endog[:4, 0] = np.nan
      exog1 = np.random.normal(size=(nobs, 1))
      exog2 = np.random.normal(size=(nobs, 2))
  
      index = pd.date_range("1970-01-01", freq="QS", periods=nobs)
      endog_pd = pd.DataFrame(endog, index=index)
      exog1_pd = pd.Series(exog1.squeeze(), index=index)
      exog2_pd = pd.DataFrame(exog2, index=index)
  
      models = [
          UnobservedComponents(endog, "llevel", exog=exog1),
          UnobservedComponents(endog, "llevel", exog=exog2),
          UnobservedComponents(endog, "llevel", exog=exog2),
          UnobservedComponents(endog_pd, "llevel", exog=exog1_pd),
          UnobservedComponents(endog_pd, "llevel", exog=exog2_pd),
          UnobservedComponents(endog_pd, "llevel", exog=exog2_pd),
      ]
  
      for mod in models:
          # Smoke tests
          mod.start_params
          res = mod.fit(disp=False)
          res.summary()
          res.predict()
          res.predict(dynamic=True)
          res.get_prediction()
  
          oos_exog = np.random.normal(size=(1, mod.k_exog))
          res.forecast(steps=1, exog=oos_exog)
          res.get_forecast(steps=1, exog=oos_exog)
  
          # Smoke tests for invalid exog
          oos_exog = np.random.normal(size=(2, mod.k_exog))
          with pytest.raises(ValueError):
              res.forecast(steps=1, exog=oos_exog)
  
          oos_exog = np.random.normal(size=(1, mod.k_exog + 1))
          with pytest.raises(ValueError):
              res.forecast(steps=1, exog=oos_exog)
  
      # Test invalid model specifications
      with pytest.raises(ValueError):
          UnobservedComponents(endog, "llevel", exog=np.zeros((10, 4)))
  
imports: import warnings
  import numpy
  from numpy.testing import assert_equal, assert_allclose, assert_raises
  import pandas
  import pytest
  from statsmodels.datasets import macrodata
  from statsmodels.tools.sm_exceptions import SpecificationWarning
  from statsmodels.tsa.statespace import structural
  from statsmodels.tsa.statespace.structural import UnobservedComponents
  from statsmodels.tsa.statespace.tests.results import results_structural
label_desc: Use image node_id 25 for calling a global function with example usage: test_misc_exog() without return types