home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-I / help / base / formula < prev    next >
Encoding:
Text File  |  1997-04-23  |  2.4 KB  |  60 lines

  1.     
  2.     _M_o_d_e_l _F_o_r_m_u_l_a_e
  3.     
  4.          y ~ model
  5.          formula(object)
  6.          formula.default(anything)
  7.          formula.formula(formula.obj)
  8.          formula.terms(terms.obj)
  9.     
  10.     _D_e_s_c_r_i_p_t_i_o_n:
  11.     
  12.          The models fit by the lm and glm functions are speci-
  13.          fied in a compact symbolic form.  The ~ operator is
  14.          basic in the formation of such models.  An expression
  15.          of the form y~model is interpreted as a specification
  16.          that the response y is modelled by a linear predictor
  17.          specified symbolically by model.  Such a model consists
  18.          of a series of terms separated by + operators.  The
  19.          terms themselves consist of variable and factor names
  20.          separated by : operators.  Such a term is interpreted
  21.          as the interaction of all the variables and factors
  22.          appearing in the term.
  23.     
  24.          In addition to + and :, a number of other operators are
  25.          useful in model formulae.  The * operator denotes fac-
  26.          tor crossing: a*b interpreted as a+b+a:b.  The ^ opera-
  27.          tor indicates crossing to the specified degree.  For
  28.          example (a+b+c)^2 is identical to (a+b+c)*(a+b+c) which
  29.          in turn expands to a formula containing the main
  30.          effects for a, b and c together with their second-order
  31.          interactions.  The %in% operator indicates that the
  32.          terms on its left are nested within those on the right.
  33.          For example a+b%in%a expands to the formula a+a:b.
  34.     
  35.          While formulae usually involve just variable and factor
  36.          names, they can also involve arithmetic expressions.
  37.          The formula log(y)~a+log(x) is quite legal.  When such
  38.          arithmetic expressions involve operators which are also
  39.          used symbolically in model formulae, there can be con-
  40.          fusion between arithmetic and symbolic operator use.
  41.          To avoid this confusion, the function I() can be used
  42.          to bracket those portions of a model formula where the
  43.          operators are used in their arithmetic sense.  For
  44.          example, in the formula y~a+I(b+c), the term b+c is to
  45.          be interpreted as the sum of b and c.
  46.     
  47.          The generic function formula and its specific methods
  48.          provide a way of extracting formulae which have been
  49.          included in other objects.
  50.     
  51.     _V_a_l_u_e:
  52.     
  53.          All the functions above produce an object of class for-
  54.          mula which contains a symbolic model formula.
  55.     
  56.     _S_e_e _A_l_s_o:
  57.     
  58.          lm, glm, terms.
  59.     
  60.