Modérateur : Groupe des modérateurs
Code : Tout sélectionner
cox.zph(modelcox)
Code : Tout sélectionner
or_time <- function(resultat) {
Delai <- seq(1,24)
ft <- ( 1 / sqrt(Delai))
## recaclul des coef aux different temps
OR_t3 <- resultat$qbar["kohne3"]+resultat$qbar["kohne3_t"] * ft
OR_t2 <- resultat$qbar["kohne2"]+resultat$qbar["kohne2_t"] * ft
# calcul des intervalles de confiance correspondant
ic_t3 <- ic_a1 <- 1.96*(sqrt(resultat$t["kohne3","kohne3"]+ft * resultat$t["kohne3_t","kohne3_t"]+2 * ft * resultat$t["kohne3","kohne3_t"]))
ic_t2 <- ic_a1 <- 1.96*(sqrt(resultat$t["kohne2","kohne2"]+ft * resultat$t["kohne2_t","kohne2_t"]+2 * ft * resultat$t["kohne2","kohne2_t"]))
## affichage des résultats
plot(exp(OR_t3) ~ Delai, type="b", ylim=c(0,10), lwd=2, col="navyblue", ylab="Hazards ratio", xlab="Délai depuis inclusion (en mois)", main="Evolution du HR pour le Köhne élevé en fonction du temps")
abline(h=1, lty=2, col = "red")
lines(x = Delai, y = exp (OR_t3 + ic_t3), lty = 3, col = "navyblue")
lines(x = Delai, y = exp (OR_t3 - ic_t3), lty = 3, col = "navyblue")
# lines(x = Delai, y = exp (OR_t2), lty = 1, col = "darkgreen", lwd=2)
axis(side = 1, at=seq(1,24, by=2))
### une matrice des résultats
or_kohne_t <- round(exp(matrix(c(OR_t2, OR_t2 - ic_t2, OR_t2 + ic_t2, OR_t3, OR_t3 - ic_t3, OR_t3 + ic_t3), ncol = 6, byrow=FALSE)),2)
colnames(or_kohne_t) <- c("OR Kohne 2", "IC bas", "IC Haut", "OR Kohne 3", "IC bas", "IC Haut")
return(or_kohne_t)
}
Retourner vers « Questions en cours »
Utilisateurs parcourant ce forum : Google [Bot] et 1 invité