code: def estimateAR(resid, design, order=1):
      """
      Estimate AR parameters using bias correction from fMRIstat.
  
      Parameters
      ----------
      resid:  array-like
          residuals from model
      model:  an OLS model used to estimate residuals
  
      Returns
      -------
      output : array
          shape (order, resid
      """
      invM = ar_bias_corrector(design, npl.pinv(design), order)
      return ar_bias_correct(resid, order, invM)
  
imports: import copy
  from os import path
  import numpy
  import numpy.linalg
  from nipy.algorithms.statistics.formula import make_recarray
  from nipy.algorithms.statistics.models.regression import ARModel, OLSModel, ar_bias_correct, ar_bias_corrector
  from nipy.core.api import AffineTransform, Image, matrix_generator, parcels
  from nipy.io.api import save_image
  from ..api import FmriImageList, axis0_generator
  from .None import outputters
label_desc: Use image node_id 3 for calling a global function with example usage: estimateAR(resid, design, order) and returns: ar_bias_correct