Generate Polynomial Basis for a Vector

DESCRIPTION:
Returns a matrix with special attritutes that represents an orthonormal polynomial.

USAGE:
poly.raw(x, degree=1, xname=<<see below>>, coefs)

REQUIRED ARGUMENTS:
x:
a numeric vector.

OPTIONAL ARGUMENTS:
degree:
a number, the degree of the orthonormal polynomial.
xname:
optional character name suffix for the columns; if supplied, the columns will be labelled "xname^1", "xname^2", etc, otherwise simply "1", "2", etc.
coefs:
list of normalization constants. This is usually the coefs attribute of an object created by a previous call to poly or poly.raw. If missing, the polynomials are self-normalized.

VALUE:
a matrix of orthonormal polynomials is returned.

The output of poly.raw(x, degree) is identical to that of poly(x, degree), and in fact poly.raw is the workhorse for poly. The basis matrix has two attributes: degree gives the degree for each column, while coefs contains the normalization constants used to construct the orthonormal polynomials. These can be used in subsequent calls to poly.raw with different values for x, in order to evaluate the same polynomial basis functions at different abscissa values.


SEE ALSO:
bs , contr.poly , formula , ns , poly .

EXAMPLES:
basis <- poly.raw(x, 5) # generate a basis for 5th degree polynomials
basis2 <- poly.raw( x2, 5, coefs = attr(basis,"coefs"))
# evaluate the same quintic basis functions at different values of x