poly | R Documentation |
Compute Polynomial fits of variables for use in linear models.
poly(x, ..., degree = 1, raw = TRUE)
x |
Variable. The variable you would like to fit a polynomial to. |
degree |
Integer. The degree of the polynomial to fit. |
raw |
Logical. Defaults is |
# Use a quadratic polynomial to predict weight based on height.
lm(weight ~ poly(height, 2), data = cdc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.