lm4 <- lm(logMaxAbund ~ logMass, data=bird, subset=bird\$Passerine == 1) # Examinez les graphiques de diagnostic opar <- par(mfrow=c(2,2)) plot(lm4) summary(lm4) par(opar) # Comparez la variance expliquée par lm2, lm3 et lm4 str(summary(lm4)) # Rappelez-vous qu'on veut le R^2 ajusté summary(lm4)\$adj.r.squared # R2-adj = -0.02 summary(lm2)\$adj.r.squared # R2-adj = 0.05 summary(lm3)\$adj.r.squared # R2-adj = 0.25 # Comparez visuellement les trois modèles opar <- par(mfrow=c(1,3)) plot(logMaxAbund ~ logMass, data=bird, main="All birds", ylab = expression("log"[10]*"(Maximum Abundance)"), xlab = expression("log"[10]*"(Mass)"), pch=19, col="yellowgreen") abline(lm2,lwd=2) plot(logMaxAbund ~ logMass, subset=Passerine == 1, data=bird, main="Passerine birds", ylab = expression("log"[10]*"(Maximum Abundance)"), xlab = expression("log"[10]*"(Mass)"), pch=19, col="violet") abline(lm4,lwd=2) plot(logMaxAbund ~ logMass, data=bird, subset=!bird\$Aquatic, main="Terrestrial birds", ylab = expression("log"[10]*"(Maximum Abundance)"), xlab = expression("log"[10]*"(Mass)"), pch=19, col="skyblue") abline(lm3,lwd=2) par(opar)