class_docstr: A Formula is a model for a mean in a regression model.
  
  It is often given by a sequence of sympy expressions, with the mean
  model being the sum of each term multiplied by a linear regression
  coefficient.
  
  The expressions may depend on additional Symbol instances, giving a
  non-linear regression model.
class_docstr_tok: ["A","Formula","is","a","model","for","a","mean","in","a","regression","model",".","It","is","often","given","by","a","sequence","of","sympy","expressions",",","with","the","mean","model","being","the","sum","of","each","term","multiplied","by","a","linear","regression","coefficient",".","The","expressions","may","depend","on","additional","Symbol","instances",",","giving","a","non-linear","regression","model","."]
docstr: Construct Formula from recarray
  
  For fields with a string-dtype, it is assumed that these are
  qualtiatitve regressors, i.e. Factors.
  
  Parameters
  ----------
  rec: recarray
      Recarray whose field names will be used to create a formula.
  keep: []
      Field names to explicitly keep, dropping all others.
  drop: []
      Field names to drop.
docstr_tok: ["Construct","Formula","from","recarray","For","fields","with","a","string-dtype",",","it","is","assumed","that","these","are","qualtiatitve","regressors",",","i.e",".","Factors",".","Parameters","--","--","--","--","--","rec",":","recarray","Recarray","whose","field","names","will","be","used","to","create","a","formula",".","keep",":","[","]","Field","names","to","explicitly","keep",",","dropping","all","others",".","drop",":","[","]","Field","names","to","drop","."]
code: def fromrec(rec, keep=[], drop=[]):
      """Construct Formula from recarray
  
      For fields with a string-dtype, it is assumed that these are
      qualtiatitve regressors, i.e. Factors.
  
      Parameters
      ----------
      rec: recarray
          Recarray whose field names will be used to create a formula.
      keep: []
          Field names to explicitly keep, dropping all others.
      drop: []
          Field names to drop.
      """
      f = {}
      for n in rec.dtype.names:
          if rec[n].dtype.kind in "SOU":
              f[n] = Factor.fromcol(rec[n], n)
          else:
              f[n] = Term(n).formula
      for d in drop:
          del f[d]
      if keep:
          elements = [t for n, t in f.items() if n in keep]
      else:
          elements = f.values()
      return sum(elements, start=Formula([]))
  
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 9 for calling the Formula obj's underlying member method code with example usage: obj.fromrec(rec, keep, drop) and returns: sum