code: def test_affine_hypothesis(model):
      # Testing affine hypothesis, compared with R car linearHypothesis
      # Note: The test statistis Phillai, Wilks, Hotelling-Lawley
      # and Roy are the same as R output but the approximate F and degree
      # of freedoms can be different. This is due to the fact that this
      # implementation is based on SAS formula [1]
      mod = model.from_formula(
          "Histamine0 + Histamine1 + Histamine3 + Histamine5 ~ Drug * Depleted",
          data,
      )
      r = mod.fit(method="svd")
      L = np.array(
          [[0, 1.2, 1.1, 1.3, 1.5, 1.4], [0, 3.2, 2.1, 3.3, 5.5, 4.4]]
      )
      M = None
      C = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])
      r0 = r.mv_test(hypotheses=[("test1", L, M, C)])
      a = [
          [0.0269, 8.0000, 12.0000, 7.6441, 0.0010],
          [1.4277, 8.0000, 14.0000, 4.3657, 0.0080],
          [19.2678, 8.0000, 6.6316, 13.7940, 0.0016],
          [18.3470, 4.0000, 7.0000, 32.1072, 0.0001],
      ]
      assert_array_almost_equal(
          r0["test1"]["stat"].values, a, decimal=4
      )
      r0.summary(
          show_contrast_L=True,
          show_transform_M=True,
          show_constant_C=True,
      )
  
imports: import os.path
  import numpy
  import pandas
  import pytest
  from statsmodels.regression.linear_model import OLS
  from statsmodels.multivariate.multivariate_ols import _MultivariateOLS, MultivariateLS
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_raises
  import patsy
label_desc: Use image node_id 9 for calling a global function with example usage: test_affine_hypothesis(model) without return types