code: def test_low_level_fixed_effects(rng):
      p = 100
      # X1 is some effects estimate, V1 their variance for "run 1"
      X1, V1 = rng.standard_normal(p), np.ones(p)
      # same thing for a "run 2"
      X2, V2 = 2 * X1, 4 * V1
      # compute the fixed effects estimate, Xf, their variance Vf,
      # and the corresponding t statistic tf
      Xf, Vf, tf, zf = _compute_fixed_effects_params(
          [X1, X2], [V1, V2], dofs=[100, 100], precision_weighted=False
      )
      # check that the values are correct
      assert_almost_equal(Xf, 1.5 * X1)
      assert_almost_equal(Vf, 1.25 * V1)
      assert_almost_equal(tf, (Xf / np.sqrt(Vf)).ravel())
      assert_almost_equal(zf, st.norm.isf(st.t.sf(tf, 200)))
  
      # Same thing, but now there is precision weighting
      Xw, Vw, _, _ = _compute_fixed_effects_params(
          [X1, X2], [V1, V2], dofs=[200, 200], precision_weighted=True
      )
      assert_almost_equal(Xw, 1.2 * X1)
      assert_almost_equal(Vw, 0.8 * V1)
  
      # F test
      XX1 = np.vstack((X1, X1))
      XX2 = np.vstack((X2, X2))
  
      Xw, Vw, *_ = _compute_fixed_effects_params(
          [XX1, XX2],
          [V1, V2],
          dofs=[200, 200],
          precision_weighted=False,
      )
      assert_almost_equal(Xw, 1.5 * XX1)
      assert_almost_equal(Vw, 1.25 * V1)
  
      # check with 2D image
      Xw, Vw, *_ = _compute_fixed_effects_params(
          [X1[:, np.newaxis], X2[:, np.newaxis]],
          [V1, V2],
          dofs=[200, 200],
          precision_weighted=False,
      )
      assert_almost_equal(Xw, 1.5 * X1[:, np.newaxis])
      assert_almost_equal(Vw, 1.25 * V1)
  
imports: import numpy
  import pytest
  import scipy.stats
  from numpy.testing import assert_almost_equal
  from sklearn.datasets import make_regression
  from sklearn.linear_model import LinearRegression
  from nilearn.glm.contrasts import Contrast, _compute_fixed_effects_params, compute_contrast, compute_fixed_effect_contrast, expression_to_contrast_vector
  from nilearn.glm.first_level import run_glm
label_desc: Use image node_id 13 for calling a global function with example usage: test_low_level_fixed_effects(rng) without return types