code: def test_ar_modeling():
      # Compare against standard routines
      rng = np.random.RandomState(20110903)
      N = 10
      Y = rng.normal(size=(N, 1)) * 10 + 100
      X = np.c_[np.linspace(-1, 1, N), np.ones((N,))]
      my_model = OLSModel(X)
      results = my_model.fit(Y)
      # fmristat wrapper
      rhos = estimateAR(results.resid, my_model.design, order=2)
      assert rhos.shape == (2,)
      assert np.all(np.abs(rhos <= 1))
      # standard routine
      rhos2 = ar_bias_correct(results, 2)
      assert_array_almost_equal(rhos, rhos2, 8)
      # Make 2D and 3D Y
      Y = rng.normal(size=(N, 4)) * 10 + 100
      results = my_model.fit(Y)
      rhos = estimateAR(results.resid, my_model.design, order=2)
      assert rhos.shape == (2, 4)
      assert np.all(np.abs(rhos <= 1))
      rhos2 = ar_bias_correct(results, 2)
      assert_array_almost_equal(rhos, rhos2, 8)
      # 3D
      results.resid = np.reshape(results.resid, (N, 2, 2))
      rhos = estimateAR(results.resid, my_model.design, order=2)
      assert rhos.shape == (2, 2, 2)
      assert np.all(np.abs(rhos <= 1))
      rhos2 = ar_bias_correct(results, 2)
      assert_array_almost_equal(rhos, rhos2, 8)
  
file_path: nipy/nipy/modalities/fmri/fmristat/tests/test_model.py
imports: import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from nipy.algorithms.statistics.formula.formulae import Formula, Term, make_recarray
  from nipy.algorithms.statistics.models.regression import OLSModel, ar_bias_correct
  from nipy.core.image.image import rollimg
  from nipy.io.api import load_image
  from nipy.testing import anatfile, funcfile
  from ...api import FmriImageList
  from ..None import model
  from ..model import ModelOutputImage, estimateAR
label_desc: Use image node_id 5 for calling a global function with example usage: test_ar_modeling() without return types