LMsummary_and_plot <- function(x) {
def.par <- par(no.readonly = TRUE) # save default, for resetting...
print(summary(x))
zones <- matrix(c(1, 2, 3, 7, 7,4, 5, 6, 7, 7), ncol=5, byrow=TRUE)
layout(zones)
plot(x, which = 1:6)
res <- x$residuals
plot(density(res), main = 'Density.Residuals')
abline(v = median(res), lty = 1)
par(def.par) #- reset to default
}
# lm.out <- lm(mpg ~ drat * vs, data = mtcars)
# LMsummary_and_plot(lm.out)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.