class_docstr: Covariance matrices for common random effects analyses.
  
  Examples
  --------
  Two subjects (here named 2 and 3):
  
  >>> subj = make_recarray([2,2,2,3,3], 's')
  >>> subj_factor = Factor('s', [2,3])
  
  By default the covariance matrix is symbolic.  The display differs a little
  between sympy versions (hence we don't check it in the doctests):
  
  >>> c = RandomEffects(subj_factor.terms)
  >>> c.cov(subj) #doctest: +IGNORE_OUTPUT
  array([[_s2_0, _s2_0, _s2_0, 0, 0],
         [_s2_0, _s2_0, _s2_0, 0, 0],
         [_s2_0, _s2_0, _s2_0, 0, 0],
         [0, 0, 0, _s2_1, _s2_1],
         [0, 0, 0, _s2_1, _s2_1]], dtype=object)
  
  With a numeric `sigma`, you get a numeric array:
  
  >>> c = RandomEffects(subj_factor.terms, sigma=np.array([[4,1],[1,6]]))
  >>> c.cov(subj)
  array([[ 4.,  4.,  4.,  1.,  1.],
         [ 4.,  4.,  4.,  1.,  1.],
         [ 4.,  4.,  4.,  1.,  1.],
         [ 1.,  1.,  1.,  6.,  6.],
         [ 1.,  1.,  1.,  6.,  6.]])
class_docstr_tok: ["Covariance","matrices","for","common","random","effects","analyses",".","Examples","--","--","--","--","Two","subjects","(","here","named","2","and","3",")",":",">",">",">","subj","=","make_recarray","(","[","2,2,2,3,3","]",",","'s","'",")",">",">",">","subj_factor","=","Factor","(","'s","'",",","[","2,3","]",")","By","default","the","covariance","matrix","is","symbolic",".","The","display","differs","a","little","between","sympy","versions","(","hence","we","do","n't","check","it","in","the","doctests",")",":",">",">",">","c","=","RandomEffects","(","subj_factor.terms",")",">",">",">","c.cov","(","subj",")","#","doctest",":","+IGNORE_OUTPUT","array","(","[","[","_s2_0",",","_s2_0",",","_s2_0",",","0",",","0","]",",","[","_s2_0",",","_s2_0",",","_s2_0",",","0",",","0","]",",","[","_s2_0",",","_s2_0",",","_s2_0",",","0",",","0","]",",","[","0",",","0",",","0",",","_s2_1",",","_s2_1","]",",","[","0",",","0",",","0",",","_s2_1",",","_s2_1","]","]",",","dtype=object",")","With","a","numeric","`","sigma","`",",","you","get","a","numeric","array",":",">",">",">","c","=","RandomEffects","(","subj_factor.terms",",","sigma=np.array","(","[","[","4,1","]",",","[","1,6","]","]",")",")",">",">",">","c.cov","(","subj",")","array","(","[","[","4.",",","4.",",","4.",",","1.",",","1",".","]",",","[","4.",",","4.",",","4.",",","1.",",","1",".","]",",","[","4.",",","4.",",","4.",",","1.",",","1",".","]",",","[","1.",",","1.",",","1.",",","6.",",","6",".","]",",","[","1.",",","1.",",","1.",",","6.",",","6",".","]","]",")"]
docstr: Compute the covariance matrix for some given data.
  
  Parameters
  ----------
  term : np.recarray
       Recarray including fields corresponding to the Terms in
       getparams(self.design_expr).
  param : np.recarray
       Recarray including fields that are not Terms in
       getparams(self.design_expr)
  
  Returns
  -------
  C : ndarray
       Covariance matrix implied by design and self.sigma.
docstr_tok: ["Compute","the","covariance","matrix","for","some","given","data",".","Parameters","--","--","--","--","--","term",":","np.recarray","Recarray","including","fields","corresponding","to","the","Terms","in","getparams","(","self.design_expr",")",".","param",":","np.recarray","Recarray","including","fields","that","are","not","Terms","in","getparams","(","self.design_expr",")","Returns","--","--","--","-","C",":","ndarray","Covariance","matrix","implied","by","design","and","self.sigma","."]
code: def cov(self, term, param=None):
      """
      Compute the covariance matrix for some given data.
  
      Parameters
      ----------
      term : np.recarray
           Recarray including fields corresponding to the Terms in
           getparams(self.design_expr).
      param : np.recarray
           Recarray including fields that are not Terms in
           getparams(self.design_expr)
  
      Returns
      -------
      C : ndarray
           Covariance matrix implied by design and self.sigma.
      """
      D = self.design(term, param=param, return_float=True)
      return np.dot(D, np.dot(self.sigma, D.T))
  
imports: import itertools
  import warnings
  from string import ascii_letters, digits
  import numpy
  import sympy
  from scipy.linalg import pinv
  from sympy import Dummy, default_sort_key
  from sympy.utilities.lambdify import implemented_function, lambdify
  from nipy.algorithms.utils.matrices import full_rank, matrix_rank
  from nipy.utils import VisibleDeprecationWarning, _NoValue
label_desc: Use image node_id 2 for calling the RandomEffects obj's underlying member method code with example usage: obj.cov(term, param) and returns: np