class_docstr: This class is meant to handle GLMs from a higher-level perspective
  i.e. by taking images as input and output
class_docstr_tok: ["This","class","is","meant","to","handle","GLMs","from","a","higher-level","perspective","i.e",".","by","taking","images","as","input","and","output"]
docstr: Load the data, mask the data, scale the data, fit the GLM
  
  Parameters
  ----------
  do_scaling : bool, optional
      if True, the data should be scaled as percent of voxel mean
  model : string, optional,
      the kind of glm ('ols' or 'ar1') you want to fit to the data
  steps : int, optional
      in case of an ar1, discretization of the ar1 parameter
docstr_tok: ["Load","the","data",",","mask","the","data",",","scale","the","data",",","fit","the","GLM","Parameters","--","--","--","--","--","do_scaling",":","bool",",","optional","if","True",",","the","data","should","be","scaled","as","percent","of","voxel","mean","model",":","string",",","optional",",","the","kind","of","glm","(","'ols","'","or","'ar1","'",")","you","want","to","fit","to","the","data","steps",":","int",",","optional","in","case","of","an","ar1",",","discretization","of","the","ar1","parameter"]
code: def fit(self, do_scaling=True, model="ar1", steps=100):
      """Load the data, mask the data, scale the data, fit the GLM
  
      Parameters
      ----------
      do_scaling : bool, optional
          if True, the data should be scaled as percent of voxel mean
      model : string, optional,
          the kind of glm ('ols' or 'ar1') you want to fit to the data
      steps : int, optional
          in case of an ar1, discretization of the ar1 parameter
      """
      from nibabel import Nifti1Image
  
      # get the mask as an array
      mask = self.mask.get_fdata().astype(np.bool_)
  
      self.glms, self.means = [], []
      for fmri, design_matrix in zip(
          self.fmri_data, self.design_matrices
      ):
          if do_scaling:
              # scale the data
              data, mean = data_scaling(fmri.get_fdata()[mask].T)
          else:
              data, mean = (
                  fmri.get_fdata()[mask].T,
                  fmri.get_fdata()[mask].T.mean(0),
              )
          mean_data = mask.astype(np.int16)
          mean_data[mask] = mean
          self.means.append(Nifti1Image(mean_data, self.affine))
          # fit the GLM
          glm = GeneralLinearModel(design_matrix)
          glm.fit(data, model, steps)
          self.glms.append(glm)
  
imports: from warnings import warn
  import numpy
  import scipy.stats
  from nibabel import Nifti1Image, load
  from nipy.algorithms.statistics.models.regression import ARModel, OLSModel
  from nipy.algorithms.statistics.utils import multiple_mahalanobis, z_score
  from nipy.io.nibcompat import get_affine, get_header
  from nipy.labs.mask import compute_mask_sessions
label_desc: Use image node_id 2 for calling the FMRILinearModel obj's underlying member method code with example usage: obj.fit(do_scaling, model, steps) without return types