class_docstr: Class to contain results from likelihood models.
  
  This is the class in which things like AIC, BIC, llf
  can be implemented as methods, not computed in, say,
  the fit method of OLSModel.
class_docstr_tok: ["Class","to","contain","results","from","likelihood","models",".","This","is","the","class","in","which","things","like","AIC",",","BIC",",","llf","can","be","implemented","as","methods",",","not","computed","in",",","say",",","the","fit","method","of","OLSModel","."]
docstr: Set up results structure.
  
  Parameters
  ----------
  theta : ndarray
      Parameter estimates from estimated model.
  
  Y : ndarray
      Data.
  
  model : ``LikelihoodModel`` instance
      Model used to generate fit.
  
  cov : None or ndarray, optional
      Covariance of thetas.
  
  dispersion : scalar, default=1
      Multiplicative factor in front of `cov`.
  
  
  nuisance : None of ndarray, optional
      Parameter estimates needed to compute logL.
  
  rank : None or scalar, optional
      Rank of the model.  If rank is not None, it is used for df_model
      instead of the usual counting of parameters.
  
  Notes
  -----
  The covariance of thetas is given by:
  
      dispersion * cov
  
  For (some subset of models) `dispersion` will typically be the mean
  square error from the estimated model (sigma^2)
docstr_tok: ["Set","up","results","structure",".","Parameters","--","--","--","--","--","theta",":","ndarray","Parameter","estimates","from","estimated","model",".","Y",":","ndarray","Data",".","model",":","``","LikelihoodModel","``","instance","Model","used","to","generate","fit",".","cov",":","None","or","ndarray",",","optional","Covariance","of","thetas",".","dispersion",":","scalar",",","default=1","Multiplicative","factor","in","front","of","`","cov","`",".","nuisance",":","None","of","ndarray",",","optional","Parameter","estimates","needed","to","compute","logL",".","rank",":","None","or","scalar",",","optional","Rank","of","the","model",".","If","rank","is","not","None",",","it","is","used","for","df_model","instead","of","the","usual","counting","of","parameters",".","Notes","--","--","-","The","covariance","of","thetas","is","given","by",":","dispersion","*","cov","For","(","some","subset","of","models",")","`","dispersion","`","will","typically","be","the","mean","square","error","from","the","estimated","model","(","sigma^2",")"]
code: def __init__(
      self,
      theta,
      Y,
      model,
      cov=None,
      dispersion=1.0,
      nuisance=None,
      rank=None,
  ):
      """Set up results structure.
  
      Parameters
      ----------
      theta : ndarray
          Parameter estimates from estimated model.
  
      Y : ndarray
          Data.
  
      model : ``LikelihoodModel`` instance
          Model used to generate fit.
  
      cov : None or ndarray, optional
          Covariance of thetas.
  
      dispersion : scalar, default=1
          Multiplicative factor in front of `cov`.
  
  
      nuisance : None of ndarray, optional
          Parameter estimates needed to compute logL.
  
      rank : None or scalar, optional
          Rank of the model.  If rank is not None, it is used for df_model
          instead of the usual counting of parameters.
  
      Notes
      -----
      The covariance of thetas is given by:
  
          dispersion * cov
  
      For (some subset of models) `dispersion` will typically be the mean
      square error from the estimated model (sigma^2)
  
      """
      self.theta = theta
      self.Y = Y
      self.model = model
      if cov is None:
          self.cov = self.model.information(
              self.theta, nuisance=self.nuisance
          )
      else:
          self.cov = cov
      self.dispersion = dispersion
      self.nuisance = nuisance
  
      self.df_total = Y.shape[0]
      self.df_model = model.df_model
      # put this as a parameter of LikelihoodModel
      self.df_residuals = self.df_total - self.df_model
  
imports: import numpy
  from nibabel.onetime import auto_attr
  from scipy.linalg import inv
  from scipy.stats import t
  from nilearn.glm._utils import pad_contrast, positive_reciprocal
label_desc: Use image node_id 1 to create a new LikelihoodModelResults object  with example: obj = LikelihoodModelResults(theta, Y, model, cov, dispersion, nuisance, rank)