1) How can I change the y-axis to "odds ratio", "probability of mortality", and "mortality rate" for "fit" in the following example?
2) How can I change the y-axis to "hazard ratio" for "fit2" in the following example?
library(Hmisc)
library(survival)
library(rms)
data(pbc)
d <- pbc
rm(pbc)
d$died <- ifelse(d$status == 2, 1, 0)
d$status <- ifelse(d$status != 0, 1, 0)
ddist <- datadist(d)
options(datadist='ddist')
fit <- lrm(status ~ rcs(age, 4), data=d)
(an <- anova(fit))
plot(Predict(fit), anova=an, pval=TRUE)
fit2 <- cph(Surv(time, status) ~ rcs(age, 4), data=d)
(an2 <- anova(fit2))
plot(Predict(fit2), anova=an, pval=TRUE)
I am looking forward to your help!
Update 1 Following BondedDust's answer I worte the following:
# probability
getProbability <- function(x) {
exp(x)/(1+exp(x))*100
}
fit <- lrm(status ~ rcs(age, 4), data=d)
(an <- anova(fit))
plot(Predict(fit, fun=getProbability), anova=an, pval=TRUE, ylab="Probability of death [%]")
# overall probability to die
table(d$status)
round(table(d$status)[[2]]/sum(table(d$status))*100, digits=1) # = 44.5%
Since the overall probability to die is 44.5% the calculation of the predicted probability and the resulting plot seems to be correct to me as non-statistician, isn't it?