doenca.dat<-scan(what=list(anos=0,suc=0,total=0)) 5.8 0 98 15.0 1 54 21.5 3 43 27.5 8 48 33.5 9 51 39.5 8 38 46.0 10 28 51.5 5 11 attach(doenca.dat) anos=doenca.dat$anos suc=doenca.dat$suc total=doenca.dat$total prop=suc/total plot(anos,prop,xlab="Anos de Exposição",ylab="Proporção de casos") lines(anos,prop) Xmat=cbind(suc,total-suc) fit=glm(Xmat~anos,family=binomial()) summary(fit) predict(fit) fitted(fit) yh=fitted(fit) X=model.matrix(fit) w=fit$weights W=diag(w) H=sqrt(W)%*%X%*%solve(t(X)%*%W%*%X)%*%t(X)%*%sqrt(W) h=diag(H) plot(h,xlab="Índice") identify(h) ro=residuals(fit,type="response") fi=1 rd=residuals(fit,type="deviance") td=rd*sqrt(fi/(1-h)) rp=residuals(fit,type="pearson") rp=sqrt(fi)*rp ts=rp/sqrt(1-h) LD=h*(ts^2)/(1-h) plot(td,ylab="Componente do desvio",xlab="Índice") identify(td) plot(LD,ylab="Distância de Cook",xlab="Índice") identify(LD)