gf_squaresid {coursekata} | R Documentation |
Add Squared Residual Visualization to a Plot
Description
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.
Usage
gf_squaresid(plot, model, aspect = 4/6, alpha = 0.1, ...)
Arguments
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 |
Value
A ggplot object with squared residuals added.
Examples
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)
[Package coursekata version 0.19.0 Index]