code: def test_invalid_fittedvalues_resid_predict():
      endog = dta["infl"].iloc[:20]
      mod = sarimax.SARIMAX(
          endog, order=(1, 0, 0), concentrate_scale=True
      )
  
      # Check that we can't do any prediction without forecast means
      res = mod.filter([0], conserve_memory=MEMORY_NO_FORECAST_MEAN)
      assert_equal(
          res.filter_results.conserve_memory, MEMORY_NO_FORECAST_MEAN
      )
  
      message = (
          "In-sample prediction is not available if memory conservation"
          " has been used to avoid storing forecast means."
      )
      with pytest.raises(ValueError, match=message):
          res.predict()
      with pytest.raises(ValueError, match=message):
          res.get_prediction()
  
      # Check that we can't do dynamic prediction without predicted means,
      # predicted covs
      options = [
          MEMORY_NO_PREDICTED_MEAN,
          MEMORY_NO_PREDICTED_COV,
          MEMORY_NO_PREDICTED,
      ]
      for option in options:
          res = mod.filter([0], conserve_memory=option)
          assert_equal(res.filter_results.conserve_memory, option)
  
          message = (
              "In-sample dynamic prediction is not available if"
              " memory conservation has been used to avoid"
              " storing forecasted or predicted state means"
              " or covariances."
          )
          with pytest.raises(ValueError, match=message):
              res.predict(dynamic=True)
          with pytest.raises(ValueError, match=message):
              res.predict(start=endog.index[10], dynamic=True)
  
file_path: statsmodels/statsmodels/tsa/statespace/tests/test_conserve_memory.py
imports: import numpy
  import pandas
  import pytest
  from numpy.testing import assert_equal, assert_allclose, assert_
  from statsmodels.datasets import macrodata
  from statsmodels.tsa.statespace import sarimax, varmax, dynamic_factor
  from statsmodels.tsa.statespace.kalman_filter import MEMORY_NO_FORECAST_MEAN, MEMORY_NO_FORECAST_COV, MEMORY_NO_PREDICTED_MEAN, MEMORY_NO_PREDICTED_COV, MEMORY_NO_PREDICTED, MEMORY_NO_SMOOTHING, MEMORY_NO_GAIN, MEMORY_CONSERVE
label_desc: Use image node_id 10 for calling a global function with example usage: test_invalid_fittedvalues_resid_predict() without return types