View source: R/r_squared_vis.R
r_squared_vis | R Documentation |
Regression Sum of Squared Visualization
r_squared_vis(
df,
formu,
x_lab = "Observed Value",
y_lab = "Predicted Value",
plot_total_variance = TRUE,
plot_all_variances = TRUE,
plot_error_variance = FALSE,
plot_regression_variance = FALSE,
plot_unit_line = TRUE,
plot_points = TRUE,
plot_means = TRUE,
plot_residuals = FALSE,
plot_residuals_squared = FALSE,
variance_alpha = 0.2,
total_variance_color = "#999999",
error_variance_color = "#ff7f00",
regression_variance_color = "#377eb8",
point_color = "grey50",
point_alpha = 0.5
)
df |
data.frame with the data to plot. |
formu |
formula for the regression. |
x_lab |
label for the x-axis. |
y_lab |
label for the y-axis. |
plot_total_variance |
plot a square representing the total variance in the dependent variable. |
plot_all_variances |
plot a squares representing all the variances (i.e. each predictor and error). |
plot_error_variance |
plot a square representing the error/residual variance. |
plot_regression_variance |
plot a square representing the total regression variance. |
plot_unit_line |
plot the unit line (i.e. y = x). |
plot_points |
plot the data points. |
plot_means |
plot horizontal and vertical lines for the means. |
plot_residuals |
plot vertical lines representing the residuals. |
plot_residuals_squared |
plot squares representing the squared residuals. |
variance_alpha |
the alpha level (transparency) of the residual squares. |
total_variance_color |
color representing the total variance. |
error_variance_color |
color representing the error variance. |
regression_variance_color |
color representing variance explained (i.e. regression variance). |
point_color |
color of the data points. |
point_alpha |
the alpha level (transparency) of the data points. |
a ggplot2 expression.
df <- VisualStats::simulate(n = 100, r_squared = .5)
formu <- y ~ x1 + x2
lm(formu, df) |> summary()
VisualStats::r_squared_vis(df, formu,
plot_total_variance = TRUE,
plot_error_variance = FALSE,
plot_all_variances = TRUE,
plot_residuals_squared = FALSE,
plot_residuals = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.