poly                  package:base                  R Documentation

_C_o_m_p_u_t_e _O_r_t_h_o_g_o_n_a_l _P_o_l_y_n_o_m_i_a_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     Returns or evaluates orthogonal polynomials of degree 1 to
     `degree' over the specified set of points `x'. These are all
     orthogonal to the constant polynomial of degree 0.

_U_s_a_g_e:

     poly(x, ..., degree = 1, coefs = NULL)
     polym(..., degree)
     predict(object, newdata, ...)

_A_r_g_u_m_e_n_t_s:

x, newdata: a numeric vector at which to evaluate the polynomial. `x'
          can also be a matrix.

  degree: the degree of the polynomial

   coefs: for prediction, coefficients from a previous fit.

  object: an object inheriting from class `"poly"', normally the result
          of a call to `poly' with a single vector argument.

     ...: `poly, polym': further vectors.
          `predict.poly': arguments to be passed to or from other
          methods. 

_D_e_t_a_i_l_s:

     Although formally `degree' should be named (as it follows `...'),
     an unnamed second argument of length 1 will be interpreted as the
     degree.

     The orthogonal polynomial is summarized by the coefficients, which
     can be used to evaluate it via the three-term recursion given in
     Kennedy & Gentle (1980, pp. 343-4), and use in the ``predict''
     part of the code.

_V_a_l_u_e:

     For `poly' with a single vector argument:
     A matrix with rows corresponding to points in `x' and columns
     corresponding to the degree, with attributes `"degree"' specifying
     the degrees of the columns and `"coefs"' which contains the
     centring and normalization constants used in constructing the
     orthogonal polynomials.  The matrix is given class `c("poly",
     "matrix")' as from R 1.5.0.

     Other cases of `poly' and `polym', and `predict.poly': a matrix.

_N_o_t_e:

     This routine is intended for statistical purposes such as
     `contr.poly': it does not attempt to orthogonalize to machine
     accuracy.

_A_u_t_h_o_r(_s):

     B. D. Ripley

_R_e_f_e_r_e_n_c_e_s:

     Kennedy, W. J. Jr and Gentle, J. E. (1980) Statistical Computing
     Marcel Dekker.

_S_e_e _A_l_s_o:

     `contr.poly'

_E_x_a_m_p_l_e_s:

     (z <- poly(1:10, 3))
     predict(z, seq(2, 4, 0.5))
     poly(seq(4, 6, 0.5), 3, coefs = attr(z, "coefs"))

     polym(1:4, c(1, 4:6), degree=3) # or just poly()
     poly(cbind(1:4, c(1, 4:6)), degree=3)

