polynomial | R Documentation |
Creates polynomial variables, to be used in regression. Will create polynomials of degree less than
or equal to the degree
specified, and will mean center variables by default.
polynomial(x, degree = 2, center = mean(x, na.rm = TRUE))
x |
variable used to create the polynomials. |
degree |
the maximum degree
polynomial to be returned. Polynomials of degree <= |
center |
the value to center the polynomials at. |
A matrix containing the linear splines.
# Reading in a dataset
data(mri)
# Create a polynomial on ldl
polynomial(mri$ldl, degree=3)
# Use a polynomial in regress
regress("mean", atrophy ~ polynomial(age, degree = 2), data = mri)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.