code: def mfx_stat(
      Y,
      V1,
      X,
      column,
      n_iter=5,
      return_t=True,
      return_f=False,
      return_effect=False,
      return_var=False,
      verbose=False,
  ):
      """Run a mixed-effects model test on the column of the design matrix
  
      Parameters
      ----------
      Y: array of shape (n_samples, n_tests)
         the data
      V1: array of shape (n_samples, n_tests)
          first-level variance associated with the data
      X: array of shape(n_samples, n_regressors)
         the design matrix of the model
      column: int,
              index of the column of X to be tested
      n_iter: int, optional,
             number of iterations of the EM algorithm
      return_t: bool, optional,
                should one return the t test (True by default)
      return_f: bool, optional,
                should one return the F test (False by default)
      return_effect: bool, optional,
                should one return the effect estimate (False by default)
      return_var: bool, optional,
                should one return the variance estimate (False by default)
  
      verbose: bool, optional, verbosity mode
  
      Returns
      -------
      (tstat, fstat, effect, var): tuple of arrays of shape (n_tests),
                                   those required by the input return booleans
  
      """
      # check that X/columns are correct
      column = int(column)
      if X.shape[0] != Y.shape[0]:
          raise ValueError("X.shape[0] is not the number of samples")
      if column > X.shape[1]:
          raise ValueError(
              "the column index is more than the number of columns"
          )
  
      # create design matrices
      contrast_mask = 1 - np.eye(X.shape[1])[column]
      X0 = X * contrast_mask
  
      # instantiate the mixed effects models
      model_0 = MixedEffectsModel(
          X0, n_iter=n_iter, verbose=verbose
      ).fit(Y, V1)
      model_1 = MixedEffectsModel(
          X, n_iter=n_iter, verbose=verbose
      ).fit(Y, V1)
  
      # compute the log-likelihood ratio statistic
      fstat = 2 * (model_1.log_like(Y, V1) - model_0.log_like(Y, V1))
      fstat = np.maximum(0, fstat)
      sign = np.sign(model_1.beta_[column])
  
      output = ()
      if return_t:
          output += (np.sqrt(fstat) * sign,)
      if return_f:
          output += (fstat,)
      if return_var:
          output += (model_1.V2,)
      if return_effect:
          output += (model_1.beta_[column],)
      return output
  
file_path: nipy/nipy/algorithms/statistics/mixed_effects_stat.py
imports: import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: mfx_stat(Y, V1, X, column, n_iter, return_t, return_f, return_effect, return_var, verbose) and returns: output