essence50.ls_lm(fuel ~ ., data=essence50) plot(1:50,lm.influence(essence50.ls)$h,main="h_ii pour les donnees d'essence") abline(h=5/50) outhess_identify(1:50,lm.influence(essence50.ls)$h) plot(essence50.ls,ask=T) # Distance de Cook plot(fitted.values(essence50.ls), residuals(essence50.ls)/(lm.influence(essence50.ls)$sigma * (1-lm.influence(essence50.ls)$h)^0.5), xlab="Valeurs predites",ylab="Residus studentizes", main="Graphique de residus LS",sub="Donnees d'essence") abline(h=qt(.025,50-5-1),lty=2) abline(h=qt(1-.025,50-5-1),lty=2) abline(h=qt(.025/50,50-5-1)) abline(h=qt(1-.025/50,50-5-1)) points(fitted.values(essence50.ls)[outhess], residuals(essence50.ls)[outhess]/(lm.influence(essence50.ls)$sigma[outhess] * (1-lm.influence(essence50.ls)$h[outhess])^0.5),pch=18,cex=2) outyess_identify(fitted.values(essence50.ls), residuals(essence50.ls)/(lm.influence(essence50.ls)$sigma * (1-lm.influence(essence50.ls)$h)^0.5)) essence50.lms_lmsreg(as.matrix(essence50[,-5]),essence50[,5]) plot(cbind(1,as.matrix(essence50[,-5])) %*% essence50.lms$coef, essence50.lms$resid, xlab="Valeurs predites",ylab="Residus",main="Graphique de residus LMS", sub="Donnees d'essence") abline(h=0) abline(h=-2.5*essence50.lms$scale) abline(h=2.5*essence50.lms$scale) points(cbind(1,as.matrix(essence50[outhess,-5])) %*% essence50.lms$coef, essence50.lms$resid[outhess],pch=18,cex=2) points(cbind(1,as.matrix(essence50[outyess,-5])) %*% essence50.lms$coef, essence50.lms$resid[outyess],pch=0,cex=2) outlmsess_identify(cbind(1,as.matrix(essence50[,-5])) %*% essence50.lms$coef, essence50.lms$resid) dimnames(essence50)[[1]][outlmsess] foret.ls_lm(LPIN ~ ., data=sally) plot(1:94,lm.influence(foret.ls)$h,main="h_ii pour les donnees de foresterie") abline(h=20/94) outh1_identify(1:94,hat(sally[,-1])) outh2_identify(1:94,hat(sally[,-1])) plot(foret.ls,ask=T) plot(fitted.values(foret.ls), residuals(foret.ls)/(lm.influence(foret.ls)$sigma * (1-lm.influence(foret.ls)$h)^0.5), xlab="Valeurs predites",ylab="Residus studentizes", main="Graphique de residus LS",sub="Donnees de foresterie") abline(h=qt(.025,94-20-1),lty=2) abline(h=qt(1-.025,94-20-1),lty=2) abline(h=qt(.025/94,94-20-1)) abline(h=qt(1-.025/94,94-20-1)) # 35, 15 et 79 sont des valeurs aberrantes # au niveau 5%, mais pas avec un ajustement # de Bonferroni outy_identify(fitted.values(foret.ls), residuals(foret.ls)/(lm.influence(foret.ls)$sigma * (1-lm.influence(foret.ls)$h)^0.5)) points(fitted.values(foret.ls)[outh1], residuals(foret.ls)[outh1]/(lm.influence(foret.ls)$sigma[outh1] * (1-lm.influence(foret.ls)$h[outh1])^0.5),pch=18,cex=2) points(fitted.values(foret.ls)[outh2], residuals(foret.ls)[outh2]/(lm.influence(foret.ls)$sigma[outh2] * (1-lm.influence(foret.ls)$h[outh2])^0.5),pch=5,cex=2) points(fitted.values(foret.ls)[outy], residuals(foret.ls)[outy]/(lm.influence(foret.ls)$sigma[outy] * (1-lm.influence(foret.ls)$h[outy])^0.5),pch=0,cex=2) foret.l1_l1fit(sally[,-1],sally[,1]) plot(cbind(1,as.matrix(sally[,-1])) %*% foret.l1$coef, foret.l1$residuals, xlab="Valeurs predites",ylab="Residus",main="Graphique de residus L1", sub="Donnees de foresterie") abline(h=0) points(cbind(1,as.matrix(sally[outh1,-1])) %*% foret.l1$coef, foret.l1$residuals[outh1],pch=18,cex=2) points(cbind(1,as.matrix(sally[outh2,-1])) %*% foret.l1$coef, foret.l1$residuals[outh2],pch=5,cex=2) points(cbind(1,as.matrix(sally[outy,-1])) %*% foret.l1$coef, foret.l1$residuals[outy],pch=0,cex=2) foret.rreg_rreg(as.matrix(sally[,-1]),sally[,1]) plot(cbind(1,as.matrix(sally[,-1])) %*% foret.rreg$coef, foret.rreg$residuals, xlab="Valeurs predites",ylab="Residus",main="Graphique de residus rreg", sub="Donnees de foresterie") abline(h=0) points(cbind(1,as.matrix(sally[outh1,-1])) %*% foret.rreg$coef, foret.rreg$residuals[outh1],pch=18,cex=2) points(cbind(1,as.matrix(sally[outh2,-1])) %*% foret.rreg$coef, foret.rreg$residuals[outh2],pch=5,cex=2) points(cbind(1,as.matrix(sally[outy,-1])) %*% foret.rreg$coef, foret.rreg$residuals[outy],pch=0,cex=2) foret.lms_lmsreg(as.matrix(sally[,-1]),sally[,1]) plot(cbind(1,as.matrix(sally[,-1])) %*% foret.lms$coef, foret.lms$resid, xlab="Valeurs predites",ylab="Residus",main="Graphique de residus LMS", sub="Donnees de foresterie") abline(h=0) abline(h=-2.5*foret.lms$scale) abline(h=2.5*foret.lms$scale) points(cbind(1,as.matrix(sally[outh1,-1])) %*% foret.lms$coef, foret.lms$resid[outh1],pch=18,cex=2) points(cbind(1,as.matrix(sally[outh2,-1])) %*% foret.lms$coef, foret.lms$resid[outh2],pch=5,cex=2) points(cbind(1,as.matrix(sally[outy,-1])) %*% foret.lms$coef, foret.lms$resid[outy],pch=0,cex=2) outlms_identify(cbind(1,as.matrix(sally[,-1])) %*% foret.lms$coef, foret.lms$resid) foret.lts_ltsreg(as.matrix(sally[,-1]),sally[,1]) plot(cbind(1,as.matrix(sally[,-1])) %*% foret.lts$coef, foret.lts$residuals, xlab="Valeurs predites",ylab="Residus",main="Graphique de residus LTS", sub="Donnees de foresterie") abline(h=0) points(cbind(1,as.matrix(sally[outh1,-1])) %*% foret.lts$coef, foret.lts$residuals[outh1],pch=18,cex=2) points(cbind(1,as.matrix(sally[outh2,-1])) %*% foret.lts$coef, foret.lts$residuals[outh2],pch=5,cex=2) points(cbind(1,as.matrix(sally[outy,-1])) %*% foret.lts$coef, foret.lts$residuals[outy],pch=0,cex=2) points(cbind(1,as.matrix(sally[outlms,-1])) %*% foret.lts$coef, foret.lts$residuals[outlms],pch=8,cex=2) outlts_identify(cbind(1,as.matrix(sally[,-1])) %*% foret.lts$coef, foret.lts$residuals) plot(cbind(1,as.matrix(sally[,-1])) %*% foret.lms$coef, foret.lms$resid, xlab="Valeurs predites",ylab="Residus",main="Graphique de residus LMS", sub="Donnees de foresterie") abline(h=0) abline(h=-2.5*foret.lms$scale) abline(h=2.5*foret.lms$scale) points(cbind(1,as.matrix(sally[outlts,-1])) %*% foret.lms$coef, foret.lms$resid[outlts],pch=17,cex=2) plot(foret.ls,ask=T) points(fitted.values(foret.ls)[outlms],residuals(foret.ls)[outlms],pch=8,cex=2) points(fitted.values(foret.ls)[outlts],residuals(foret.ls)[outlts],pch=17,cex=2) identify(fitted.values(foret.ls),residuals(foret.ls))