View source: R/gf_resid_gf_squaresid.R
gf_squaresid | R Documentation |
This function adds squared residual representations to a ggformula plot, illustrating squared error as a polygon. The function dynamically adjusts the aspect ratio to ensure proper scaling of squares.
gf_squaresid(plot, model, aspect = 4/6, alpha = 0.1, ...)
plot |
A ggformula plot object, typically created with |
model |
A fitted linear model object created using |
aspect |
A numeric value controlling the square's aspect ratio. Default is |
alpha |
A numeric value specifying the transparency of the square's fill. Default is |
... |
Additional aesthetics passed to |
A ggplot object with squared residuals added.
Height_model <- lm(Thumb ~ Height, data = Fingers)
gf_point(Thumb ~ Height, data = Fingers) %>%
gf_model(Height_model) %>%
gf_squaresid(Height_model, color = "blue", alpha = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.