code: def test_simulate_equivalence():
      # regression test, needs large k_mc to be reliable
  
      k_groups = 4
      k_repl = 10
      nobs = np.array([10, 12, 13, 15]) * k_repl
      means = np.array([-1, 0, 0, 1]) * 0.12
      vars_ = np.array([1, 2, 3, 4])
      nobs_t = nobs.sum()
  
      eps = 0.0191 * 10
      opt_var = ["unequal", "equal", "bf"]
      k_mc = 100
      np.random.seed(987126)
      res_mc = smo.simulate_power_equivalence_oneway(
          means,
          nobs,
          eps,
          vars_=vars_,
          k_mc=k_mc,
          trim_frac=0.1,
          options_var=opt_var,
          margin_type="wellek",
      )
  
      frac_reject = (res_mc.pvalue <= 0.05).sum(0) / k_mc
      assert_allclose(frac_reject, [0.17, 0.18, 0.14], atol=0.001)
      # result with k_mc = 10000 is [0.1466, 0.1871, 0.1606]
      # similar to asy below, but not very close for all
  
      es_alt_li = []
      for uv in opt_var:
          es = effectsize_oneway(means, vars_, nobs, use_var=uv)
          es_alt_li.append(es)
  
      # compute asy power as comparison
      margin = wellek_to_f2(eps, k_groups)
      pow_ = [
          power_equivalence_oneway(
              es_,
              margin,
              nobs_t,
              n_groups=k_groups,
              df=None,
              alpha=0.05,
              margin_type="f2",
          )
          for es_ in es_alt_li
      ]
      # regression test numbers
      assert_allclose(pow_, [0.147749, 0.173358, 0.177412], atol=0.007)
  
imports: import numpy
  from numpy.testing import assert_allclose, assert_equal
  import pytest
  from statsmodels.regression.linear_model import OLS
  import statsmodels.stats.power
  import statsmodels.stats.oneway
  from statsmodels.stats.oneway import confint_effectsize_oneway, confint_noncentrality, effectsize_oneway, anova_oneway, anova_generic, equivalence_oneway, equivalence_oneway_generic, power_equivalence_oneway, _power_equivalence_oneway_emp, f2_to_wellek, fstat_to_wellek, wellek_to_f2
  from statsmodels.stats.robust_compare import scale_transform
  from statsmodels.stats.contrast import wald_test_noncent_generic, wald_test_noncent, _offset_constraint
label_desc: Use image node_id 6 for calling a global function with example usage: test_simulate_equivalence() without return types