code: def estimate_cv_regression(
      results: pd.DataFrame, statistic: str
  ) -> tuple[dict[int, list[float]], float]:
      # For percentiles 1, 5 and 10, regress on a constant, and powers of 1/T
      out = {}
      quantiles = np.asarray(results.index)
      tau = np.array(results.columns).reshape((1, -1)).T
      rhs = (1.0 / tau) ** np.arange(4)
      for cv in CRITICAL_VALUES:
          if META[statistic] == "negative":
              loc = np.argmin(np.abs(100 * quantiles - cv))
          else:
              loc = np.argmin(np.abs(100 * quantiles - (100 - cv)))
          lhs = np.squeeze(np.asarray(results.iloc[loc]))
          xval(lhs, rhs)
          res = OLS(lhs, rhs).fit()
          params = res.params.copy()
          if res.pvalues[-1] > 0.05:
              params[-1] = 0.00
          out[cv] = [float(round(val, 5)) for val in params]
      return out, float(tau.min())
  
imports: from __future__ import annotations
  from collections import defaultdict
  import glob
  from itertools import product
  import os
  from typing import NamedTuple, cast
  from black import FileMode, TargetVersion, format_file_contents
  import matplotlib.backends.backend_pdf
  import matplotlib.pyplot
  import numpy
  import pandas
  from phillips_ouliaris import FILE_TYPES, ROOT, TRENDS
  from scipy import stats
  import seaborn
  from shared import format_dict
  from statsmodels.regression.linear_model import OLS, WLS
label_desc: Use image node_id 2 for calling a global function with example usage: estimate_cv_regression(results, statistic) and returns: out,  float