#-----------------------------------------------------------------------# # Comandos: # fit.model = ajuste # attach(dados) # source("diag_quase.txt") #-----------------------------------------------------------------------# par(mfrow=c(1,2)) X = model.matrix(fit.model) n = nrow(X) p = ncol(X) w = fit.model$weights W = diag(w) H = solve(t(X)%*%W%*%X) H = sqrt(W)%*%X%*%H%*%t(X)%*%sqrt(W) h = diag(H) sigma2 = summary(fit.model)$dispersion ts = resid(fit.model,type="pearson")/sqrt(sigma2) di = (h/((1-h)*2))*(ts^2) a = min(td) b = max(td) # plot(di,xlab="Indice", ylab="Distancia de Cook", pch=16, cex=2, cex.axis=1.5, cex.lab=1.5) #identify(di, n=1,cex=2) # plot(predict(fit.model), ts,xlab="Preditor Linear", ylab="Residuo de Pearson", ylim=c(a-1,b+1), pch=16) abline(2,0,lty=2,lwd=2) abline(-2,0,lty=2,lwd=2) #identify(fitted(fit.model), ts, n=1,cex=2) #-----------------------------------------------------------------------#