r - How can I plot the residuals of lm() with ggplot? -


i have nice plot residuals got lm() model. use plot(model$residuals), want have nicer. if try plot ggplot, error message:

ggplot2 doesn't know how deal data of class numeric

fortify no longer recommended , might deprecated according hadley.

you can use broom package similar (better):

library(broom) y <-rnorm(10) x <-1:10 mod <- lm(y ~ x) df <- augment(mod) ggplot(df, aes(x = .fitted, y = .resid)) + geom_point() 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -