It makes graphs for the regression models: linear, quadratic and cubic, allowing the plotting of the R-square, the equation, and other aspects related to regression.
regr_easy_graf(
x,
y,
model = "L",
plot_eq = TRUE,
plot_R2 = TRUE,
plot_res = TRUE,
title = "",
subtitle = "",
title_x = "x",
title_y = "y",
pch = 21,
pch_size = 2.5,
pch_fill = "black",
pch_colour = "black",
point_max = FALSE,
equ_pos = NULL,
R2_pos = NULL,
l_type = 1,
l_color = "red",
col_resid = "red",
ax_size = 12,
ax_title_size = 12,
equ_tex_size = 12,
pch_max = 4,
pmax_size = 2.5,
pmax_fill = "red",
pmax_col = "red",
lmax_type = 2,
lmax_col = "red",
lmax_size = 0.5,
lmax_alpha = 1
)Returns a ggplot2 for the defined regression model.
Values that should be used as an independent variable for the regression calculation.
Values that should be used as a dependent variable for the regression calculation.
Character, defined which model will be calculated. model = "L", calculate the linear, model = "Q" calculate the quadratic, model = "C" calculate the cubic, model = "all" = calculate both). Default "L".
Logical, if TRUE (default) plots the regression equation on the graph.
Logical, if TRUE (default) plots the regression R-square on the graph.
Logical, if true (default), it plots segments referring to the residuals in the graph.
Character, title of the graph.
Character, subtitle of the graph.
Character, x axis label in plot.
Character, y axis label in plot.
y and x plot symbol. Default = 21.
Size, padding and contour of points (pch) of y and x. Defaults = 2.5, "black", "black").
Logical, if TRUE, the value corresponding to the maximum value will be added to the graph. Valid only for model="Q". Default = FALSE.
A vector of 2 values to position the equation on the graph, if NULL will be plotted at a predefined position.
A vector of 2 values to position the R-square on the graph, if NULL will be plotted at a predefined position.
Line type e color to use in the regression equation curve. Defaults = 1,"red".
Color to be used in the residuals of the regression equation. Default = "red.
Size for axis marking labels. Default = 12.
Size for axis titles. Defaults = 12,12.
Size for the regression equation e R-square. Default = 12.
Symbol of the maximum value of the quadratic regression model. Default = 4.
Size, padding and outline of the maximum value symbol of the quadratic regression model. Defaults = 2.5, "red, "red.
Type, color, size and transparency of the maximum value line of the quadratic regression model. Defaults = 2, "red", 0.5, 1.
library(regr.easy)
x <- seq(0,300,50)
y <- c(138.6,153.6,164.525,164.925,158.725,159.975,154.425)
regr_easy_graf(x,y, model = "Q")
Run the code above in your browser using DataLab