code: def test_distribute_group_specific_effect_over(diabetes_data):
      # 163 unique levels of BMI in diabetes_data
      # With intercept
      model = bmb.Model("BP ~ (C(age_grp)|BMI)", diabetes_data)
  
      # Treatment encoding because of the intercept
      levels = sorted(list(diabetes_data["age_grp"].unique()))[1:]
      levels = [str(level) for level in levels]
  
      assert "C(age_grp)|BMI" in model.response_component.terms
      assert "1|BMI" in model.response_component.terms
      assert (
          model.response_component.terms["C(age_grp)|BMI"].coords[
              "C(age_grp)__expr_dim"
          ]
          == levels
      )
  
      # This is equal to the sub-matrix of Z that corresponds to this term.
      # 442 is the number of observations. 163 the number of groups.
      # 2 is the number of levels of the categorical variable 'C(age_grp)' after removing
      # the reference level. Then the number of columns is 326 = 163 * 2.
      assert model.response_component.terms[
          "C(age_grp)|BMI"
      ].data.shape == (442, 326)
  
      # Without intercept. Reference level is not removed.
      model = bmb.Model("BP ~ (0 + C(age_grp)|BMI)", diabetes_data)
      assert "C(age_grp)|BMI" in model.response_component.terms
      assert not "1|BMI" in model.response_component.terms
      assert model.response_component.terms[
          "C(age_grp)|BMI"
      ].data.shape == (442, 489)
  
imports: import logging
  from functools import reduce
  from operator import add
  from os.path import dirname, join
  import arviz
  import numpy
  import pandas
  import pymc
  import pytest
  from formulae import design_matrices
  import bambi
  from bambi.terms import CommonTerm, GroupSpecificTerm
label_desc: Use image node_id 6 for calling a global function with example usage: test_distribute_group_specific_effect_over(diabetes_data) without return types