# # event.plot() gera o gráfico de eventos e um simples gráfico para # o número acumulado de falhas de UM SISTEMA. # Os dados devem estar no formato LONGO. # rm(list=ls()) # event.plot <- function(time,event,id){ # função gera gráfico de eventos d <- 0.03 plot(0,1,xlim=c(0,max(time)+10),ylim=c(0,max(id)+0.5),xlab="t", ylab="Sistema",axes=F,type="n") axis(1) axis(2,seq(1,max(id),by=1),labels=c(max(id):1),lty=0) points(time[event==1],I(max(id)+1-id[event==1]),pch=16) segments(rep(0,max(id)),seq(max(id)),rev(c(by(time,id,max))),seq(max(id))) segments(rev(c(by(time,id,max))),seq(max(id))+d,rev(c(by(time,id,max))),seq(max(id))-d) } # # UM ÚNICO SISTEMA - Melhorando # fail1<-c(3,9,20,25,41,50,69,91,128,151,182,227) event<-rep(1,12) id<-rep(1,12) falha<-seq(1,12) # event.plot(time=fail1,event=event,id=id) # Gráfico de evento # plot(c(0,fail1),c(0,falha),type="s", ylab="N(t)",xlab="t") # Gráfico do número acumulado de falhas (primeiro sistema) # # SEM TENDÊNCIA # fail2<-c(9,20,65,88,104,107,138,143,149,186,208,227) event<-rep(1,12) id<-rep(1,12) falha<-seq(1,12) # event.plot(time=fail2,event=event,id=id) # Gráfico de evento # plot(c(0,fail2),c(0,falha),type="s", ylab="N(t)",xlab="t") # Gráfico do número acumulado de falhas (primeiro sistema) # # PIORANDO # fail3<-c(45,76,113,129,152,174,193,199,210,219,224,227) event<-rep(1,12) id<-rep(1,12) falha<-seq(1,12) # event.plot(time=fail3,event=event,id=id) # Gráfico de evento # plot(c(0,fail3),c(0,falha),type="s", ylab="N(t)",xlab="t") # Gráfico do número acumulado de falhas (primeiro sistema) # # TTT PLOT # plot(falha/falha[12],fail1/fail1[12],xlim=c(0,1),ylim=c(0,1), ylab="ttt",xlab="i/k") abline(0,1) # plot(falha/falha[12],fail2/fail2[12],xlim=c(0,1),ylim=c(0,1), ylab="ttt",xlab="i/k") abline(0,1) # plot(falha/falha[12],fail3/fail3[12],xlim=c(0,1),ylim=c(0,1), ylab="ttt",xlab="i/k") abline(0,1) # # # Testes de Tendência # Laplace # fail<-fail3 x<-fail[length(fail)] y<-sum(fail)-x z<-length(fail)-1 L<-(((y/z)-(x/2))/(x/sqrt(12*z))) 2*(1-pnorm(abs(L))) # x<-fail3[length(fail3)] y<-sum(fail3)-x z<-length(fail3)-1 L<-(((y/z)-(x/2))/(x/sqrt(12*z))) 2*(1-pnorm(L)) # # Militar # fail<-fail3 x<-fail[length(fail)] M<- 2*(sum(log(x/fail))) 2*(1-pchisq(M,22)) # # MAIS DE UM SISTEMA # fail <- read.table("dados_345_uniforme.txt",head=T) dim(fail) fail$tempo<-fail$HORAS_NO fail$cens<-fail$CENSURA fail$id<-fail$UNIDADE # event.plot(time=fail$tempo,event=fail$cens,id=fail$id) # Gráfico de eventos # plot(c(0,fail$tempo[fail$id==1]),c(0,fail$falha[fail$id==1]),type="s", ylab="N(t)",xlab="t") # Gráfico do número acumulado de falhas (primeiro sistema) #