Learn R Programming

kvr2 (version 0.2.0)

plot_diagnostic: Plot Observed vs Predicted Values

Description

A diagnostic plot to visualize why R-squared might be low or negative. It compares the model predictions (identity line) against the mean (horizontal line).

Usage

plot_diagnostic(x, ...)

Value

A ggplot object representing the visual analysis.

Arguments

x

A fitted lm object.

...

Currently ignored.

Examples

Run this code
df1 <- data.frame(x = 1:6, y = c(15, 37, 52, 59, 83, 92))
model <- lm(y ~ x - 1, data = df1) # No-intercept model
plot_diagnostic(model)

Run the code above in your browser using DataLab