Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. library("MASS")
  2. data(faithful)
  3. str(faithful)
  4. dt <- faithful[c("eruptions","waiting")]
  5. summary(dt)
  6. with(dt,plot(eruptions ~ waiting))
  7. with(dt,cor(eruptions,waiting))
  8. with(dt,cor(eruptions,waiting)^2)
  9.  
  10. model <- lm(formula = eruptions ~ waiting, data = faithful)
  11. summary(model)
  12.  
  13. boxplot(eruptions ~ waiting,data = dt, xlab="Waiting", ylab="Eruptions")
  14.  
  15. resid <- rstandard(model)
  16. qqnorm(resid, ylab="Standardized Residuals",
  17. xlab="Normal Scores", main="Eruptions")
  18. qqline(resid)
  19.  
  20. sisaan <- resid(model)
  21. plot(dt$eruptions, sisaan, ylab="Residuals",
  22. xlab="Eruptions", main="Plot Sisaan")
  23. abline(0,0)
  24.  
  25. nrow(faithful)
  26. plot(1:272, sisaan, ylab="Residuals")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement