Simple histogram and Standardized Residual plot
R
# Generate some random data x <- rnorm (50) y <- 2*x + rnorm (50) # Fit a linear regression model model <- lm (y ~ x) # Plot the simple histogram hist (y, main = "Simple Histogram" ) # Plot the standardized residual plot plot (model, which = 1, main = "Standardized Residue Plot" ) |
Here is a straightforward histogram of the y variable, which displays the distribution of the answer variable, will be the first plot. The second plot will be the standardised residual plot, which displays the standard deviations by which each measurement deviates from the fitted regression line. The distinction between the two plots is that the histogram displays the response variable’s distribution, whereas the standardised residual plot displays the residuals—the discrepancies between the observed and predicted values—distribution. The standardised residual plot can be used to spot outliers and evaluate the regression model’s general goodness of fit.
Contact Us