code: def ols(axis, y, X):
      y = np.rollaxis(y, 0, axis + 1)  ## time index is axis
      X = X
      m = glm(y, X, axis=axis)
      m1 = glm(y, X, axis=axis, method="kalman")
      b = m.beta
      b1 = m1.beta
      v = m.s2
      v1 = m1.s2
      print("Comparing standard OLS with Kalman OLS...")
      re = (np.abs(b - b1) / (np.abs(b) + 1e-20)).mean()
      print(f"  Relative difference in Effect estimate: {re}")
      re = (np.abs(v - v1) / (np.abs(v) + 1e-20)).mean()
      print(f"  Relative difference in Variance: {re}")
      tcon = m.contrast([1, 0])
      tcon1 = m1.contrast([1, 0])
      z = tcon.zscore()
      z1 = tcon1.zscore()
      re = (abs(z - z1) / (abs(z) + 1e-20)).mean()
      print(f"  Relative difference in z score: {re}")
  
file_path: nipy/nipy/labs/glm/benchmarks/bench_glm.py
imports: import numpy
  from ..glm import glm
label_desc: Use image node_id 2 for calling a global function with example usage: ols(axis, y, X) without return types