code: def group_analysis(design, contrast):
      """Compute group analysis effect, t, sd for `design` and `contrast`
  
      Saves to disk in 'group' analysis directory
  
      Parameters
      ----------
      design : {'block', 'event'}
      contrast : str
          contrast name
      """
      array = np.array  # shorthand
      # Directory where output will be written
      odir = futil.ensure_dir(futil.DATADIR, "group", design, contrast)
  
      # Which subjects have this (contrast, design) pair?
      subj_con_dirs = futil.subj_des_con_dirs(design, contrast)
      if len(subj_con_dirs) == 0:
          raise ValueError(f"No subjects for {design}, {contrast}")
  
      # Assemble effects and sds into 4D arrays
      sds = []
      Ys = []
      for s in subj_con_dirs:
          sd_img = load_image(pjoin(s, "sd.nii"))
          effect_img = load_image(pjoin(s, "effect.nii"))
          sds.append(sd_img.get_fdata())
          Ys.append(effect_img.get_fdata())
      sd = array(sds)
      Y = array(Ys)
  
      # This function estimates the ratio of the fixed effects variance
      # (sum(1/sd**2, 0)) to the estimated random effects variance
      # (sum(1/(sd+rvar)**2, 0)) where rvar is the random effects variance.
  
      # The EM algorithm used is described in:
      #
      # Worsley, K.J., Liao, C., Aston, J., Petre, V., Duncan, G.H.,
      #    Morales, F., Evans, A.C. (2002). \'A general statistical
      #    analysis for fMRI data\'. NeuroImage, 15:1-15
      varest = onesample.estimate_varatio(Y, sd)
      random_var = varest["random"]
  
      # XXX - if we have a smoother, use
      # random_var = varest['fixed'] * smooth(varest['ratio'])
  
      # Having estimated the random effects variance (and possibly smoothed it),
      # the corresponding estimate of the effect and its variance is computed and
      # saved.
  
      # This is the coordmap we will use
      coordmap = futil.load_image_ds105(
          "fiac_00", "wanatomical.nii"
      ).coordmap
  
      adjusted_var = sd**2 + random_var
      adjusted_sd = np.sqrt(adjusted_var)
  
      results = onesample.estimate_mean(Y, adjusted_sd)
      for n in ["effect", "sd", "t"]:
          im = api.Image(results[n], copy(coordmap))
          save_image(im, pjoin(odir, f"{n}.nii"))
  
imports: import warnings
  from copy import copy
  from imp import reload
  from os.path import join
  from tempfile import NamedTemporaryFile
  import ds105_util
  import numpy
  from nipy.algorithms.statistics import onesample
  from nipy.algorithms.statistics.api import ARModel, OLSModel, isestimable, make_recarray
  from nipy.core import api
  from nipy.core.api import Image
  from nipy.core.image.image import rollimg
  from nipy.io.api import load_image, save_image
  from nipy.modalities.fmri import design
  from nipy.modalities.fmri.fmristat import hrf
label_desc: Use image node_id 3 for calling a global function with example usage: group_analysis(design, contrast) without return types