code: def estimate_cv_regression(
      results: pd.DataFrame, critical_values: Sequence[float]
  ) -> dict[float, list[float]]:
      """
      Parameters
      ----------
      results : DataFrame
          A dataframe with rows contaoning the quantiles and columns containign the
          number of observations
      critical_values : Sequence[float]
          The critical values to use
      """
      # 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:
          loc = np.argmin(np.abs(100 * quantiles - cv))
          lhs = np.squeeze(np.asarray(results.iloc[loc]))
          res = OLS(lhs, rhs).fit()
          params = res.params.copy()
          params[res.pvalues > 0.05] = 0.0
          out[cv] = [round(val, 5) for val in params]
      return out
  
file_path: arch/arch/unitroot/critical_values/simulation/shared.py
imports: from __future__ import annotations
  from collections.abc import Sequence
  from typing import Any, NamedTuple
  import numpy
  import pandas
  from scipy import stats
  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, critical_values) and returns: out