code: def test_invalid():
      # Tests that trying to use the Chandrasekhar recursions in invalid
      # situations raises an error
  
      # Missing values
      endog = np.zeros(10)
      endog[1] = np.nan
      mod = sarimax.SARIMAX(endog)
      mod.ssm.filter_chandrasekhar = True
      with pytest.raises(
          RuntimeError,
          match=(
              "Cannot use Chandrasekhar"
              " recursions with missing data."
          ),
      ):
          mod.filter([0.5, 1.0])
  
      # Alternative timing
      endog = np.zeros(10)
      mod = sarimax.SARIMAX(endog)
      mod.ssm.filter_chandrasekhar = True
      mod.ssm.timing_init_filtered = True
      with pytest.raises(
          RuntimeError,
          match=(
              "Cannot use Chandrasekhar"
              " recursions with filtered"
              " timing."
          ),
      ):
          mod.filter([0.5, 1.0])
  
      # Time-varying matrices
      endog = np.zeros(10)
      mod = sarimax.SARIMAX(endog)
      mod.ssm.filter_chandrasekhar = True
      mod["obs_cov"] = np.ones((1, 1, 10))
      with pytest.raises(
          RuntimeError,
          match=(
              "Cannot use Chandrasekhar"
              " recursions with time-varying"
              r" system matrices \(except for"
              r" intercept terms\)."
          ),
      ):
          mod.filter([0.5, 1.0])
  
file_path: statsmodels/statsmodels/tsa/statespace/tests/test_chandrasekhar.py
imports: import numpy
  import pandas
  from .results import results_varmax
  from statsmodels.tsa.statespace import sarimax, varmax
  from statsmodels.tsa.statespace.kalman_filter import MEMORY_CONSERVE, MEMORY_NO_LIKELIHOOD
  from numpy.testing import assert_allclose
  import pytest
label_desc: Use image node_id 6 for calling a global function with example usage: test_invalid() without return types