Sie sind auf Seite 1von 2

### Exemplo 2 (Aleitamento MAterno) uando Modelo de Cox ### require(survival) desmame<-read.table("http://www.est.ufpr.br/~suely/sobrev/desmame.

txt",h=T) fit<-coxph(Surv(tempo,cens)~V1+V3+V4+V6,data=desmame,x = T,method="breslow") summary(fit) fit$loglik -2*fit$loglik attach(desmame) fit1<-coxph(Surv(tempo[V1==0],cens[V1==0])~1, data=desmame, x = T, method="bres low") ss<- survfit(fit1) s0<-round(ss$surv,digits=5) H0<- -log(s0) plot(ss$time,log(H0), xlim=range(c(0,20)),xlab="Tempos",ylab=expression(log(Lam bda[0]*(t))),bty="n",type="s") fit2<-coxph(Surv(tempo[V1==1],cens[V1==1]) ~ 1, data=desmame, x = T, method="br eslow") ss<- survfit(fit2) s0<-round(ss$surv,digits=5) H0<- -log(s0) lines(ss$time,log(H0),type="s",lty=2) legend(10,-3,lty=c(2,1),c("V1 = 1 (No)","V1 = 0 (Sim)"),lwd=1,bty="n",cex=0.7) title("V1: Experincia Amamentao") resid(fit,type="scaledsch") cox.zph(fit) par(mfrow=c(2,2)) plot(cox.zph(fit)) ### Exemplo 3 - Leucemia Pediatrica usando modelo de Cox ### leuc<-read.table("http://www.est.ufpr.br/~suely/sobrev/leucemia.txt", h=T) attach(leuc) idadec<-ifelse(idade>96,1,0) leuinic<-ifelse(leuini>75,1,0) zpesoc<-ifelse(zpeso>-2,1,0) zestc<-ifelse(zest>-2,1,0) pasc<-ifelse(pas>0.05,1,0) vacc<-ifelse(vac>15,1,0) pasc<-ifelse(pas>5,1,0) riskc<-ifelse(risk>1.7,1,0) r6c<-r6 leucc<-as.data.frame(cbind(leuinic,tempos,cens,idadec,zpesoc,zestc,pasc,vacc,ri skc,r6c)) detach(leuc) attach(leucc) require(survival) fit<-coxph(Surv(tempos,cens)~leuinic+idadec+zpesoc+zestc+pasc+vacc+riskc+r6c, data=leucc, x = T, method="breslow") summary(fit) fit3<-coxph(Surv(tempos,cens)~leuinic+idadec+zpesoc+pasc+vacc,data=leucc,x = T, method="breslow") summary(fit3) fit3$loglik

-2*fit3$loglik[2] fit<-coxph(Surv(tempos[leuinic==1],cens[leuinic==1]) ~ 1, data=leucc, x = T, me thod="breslow") ss<- survfit(fit) s0<-round(ss$surv,digits=5) H0<- -log(s0) plot(ss$time,log(H0), xlab="Tempos",ylim=range(c(-5,1)),ylab = expression(log(L ambda[0]* (t))),bty="n",type="s") fit<-coxph(Surv(tempos[leuinic==0],cens[leuinic==0]) ~ 1, data=leucc, x = T, me thod="breslow") ss<- survfit(fit) s0<-round(ss$surv,digits=5) H0<- -log(s0) lines(ss$time,log(H0),type="s",lty=4) legend(1.5,-4,lty=c(4,1),c("leuini < 75","leuini > 75"),lwd=1,bty="n",cex=0.8) title("LEUINI") resid(fit3,type="scaledsch") cox.zph(fit3) par(mfrow=c(2,3)) plot(cox.zph(fit3)) par(mfrow=c(1,2)) mart<-resid(fit3,type="martingale") dev<-resid(fit3,type="deviance") plot(mart,ylab="res",pch=20) title("Resduos Martingale") plot(dev,ylab="res",pch=20) title("Resduos Deviance")

Das könnte Ihnen auch gefallen