View source: R/polynomial_regression_plot.R
polynomial_regression_plot | R Documentation |
The function create a simple regression plot (no interaction). Can be used to visualize polynomial regression.
polynomial_regression_plot(
model,
model_data = NULL,
predictor,
graph_label_name = NULL,
x_lim = NULL,
y_lim = NULL,
plot_color = FALSE
)
model |
object from |
model_data |
optional dataframe (in case data cannot be retrieved from the model) |
predictor |
predictor variable name (must be character) |
graph_label_name |
vector of length 3 or function. Vector should be passed in the form of |
x_lim |
the plot's upper and lower limit for the x-axis. Length of 2. Example: |
y_lim |
the plot's upper and lower limit for the y-axis. Length of 2. Example: |
plot_color |
default if |
It appears that predict
cannot handle categorical factors. All variables are converted to numeric before plotting.
an object of class ggplot
fit = lm(data = iris, Sepal.Length ~ poly(Petal.Length,2))
polynomial_regression_plot(model = fit,predictor = 'Petal.Length')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.