polynomial {rigr} | R Documentation |
Create Polynomials
Description
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.
Usage
polynomial(x, degree = 2, center = mean(x, na.rm = TRUE))
Arguments
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. |
Value
A matrix containing the linear splines.
Examples
# 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)
[Package rigr version 1.0.4 Index]