code: def anova3_lm_single(
      model, design_info, n_rows, test, pr_test, robust
  ):
      n_rows += _has_intercept(design_info)
      terms_info = design_info.terms
  
      names = ["sum_sq", "df", test, pr_test]
  
      table = DataFrame(np.zeros((n_rows, 4)), columns=names)
      cov = _get_covariance(model, robust)
      col_order = []
      index = []
      for i, term in enumerate(terms_info):
          # grab term, hypothesis is that term == 0
          cols = design_info.slice(term)
          L1 = np.eye(model.model.exog.shape[1])[cols]
          L12 = L1
          r = L1.shape[0]
  
          if test == "F":
              f = model.f_test(L12, cov_p=cov)
              table.loc[table.index[i], test] = test_value = f.fvalue
              table.loc[table.index[i], pr_test] = f.pvalue
  
          # need to back out SSR from f_test
          table.loc[table.index[i], "df"] = r
          # col_order.append(cols.start)
          index.append(term.name())
  
      table.index = Index(index + ["Residual"])
      # NOTE: Do not need to sort because terms are an ordered dict now
      # table = table.iloc[np.argsort(col_order + [model.model.exog.shape[1]+1])]
      # back out sum of squares from f_test
      ssr = table[test] * table["df"] * model.ssr / model.df_resid
      table["sum_sq"] = ssr
      # fill in residual
      table.loc["Residual", ["sum_sq", "df", test, pr_test]] = (
          model.ssr,
          model.df_resid,
          np.nan,
          np.nan,
      )
      return table
  
imports: from statsmodels.compat.python import lrange
  import numpy
  import pandas
  from pandas import DataFrame, Index
  import patsy
  from scipy import stats
  from statsmodels.formula.formulatools import _has_intercept, _intercept_idx, _remove_intercept_patsy
  from statsmodels.iolib import summary2
  from statsmodels.regression.linear_model import OLS
label_desc: Use image node_id 5 for calling a global function with example usage: anova3_lm_single(model, design_info, n_rows, test, pr_test, robust) and returns: table