The R package ‘survivalPLANN’ contains a variety of functions to predictive survival rates from neural network. It also allows us to predictive relative survivals. The Partial Logistic Artificial Neural Networks (PLANN) are implemented, proposed by Biganzoli et al. (1998). S3 methods are included to evaluate the predictive capacities, as well as predictions from new observations.
## import libraries
library(survivalPLANN)
library(relsurv)
#library(survivalNET)
#library(lubridate)
## data management
data(dataK) # import the data base (colorectal cancers from the 'relsurv' package)
$agey <- dataK$age/365.241
dataK
## estimation of the hyperparameters
<- floor(max(dataK$time[dataK$event==1])/365.241) # 13 years
pro.time
<- cvPLANN(Surv(time, event)~ sex + agey + stade + delay, data=dataK, cv=10,
tune.sPLANN pro.time=pro.time*365.241, inter=365.241/12, size=2:5, decay=c(0.01, 0.1))
$optimal$size
tune.sPLANN# [1] 2
$optimal$decay
tune.sPLANN# [1] 0.01
## estimation of the network according to the previous optimal parameters
<- sPLANN(Surv(time, event)~ sex + agey + stade + delay, data=dataK,
splann pro.time=pro.time*365.241, inter=365.241/12, size=2, decay=0.01, maxit=1000)
# predictions for a 50-years old patientwith no delay at the diagnostic
# of a non-agressive cancer according to the gender
<- data.frame(sex=c(1,2), agey=c(50,60), stade=c(0,0), delay=c(0,0))
dnew
<- predict(splann, newdata = dnew) #survival predictions for dnew
datap
plot(c(0,datap$times/365.241), c(1,datap$predictions[1,]), ylab="Patient survival",
xlab="Post-diagnosis time in years", type="l") # sex=1 (male)
lines(c(0,datap$times/365.241), c(1,datap$predictions[2,]), type="l", col=2) #sex=2 (female)
data("fr.ratetable") # import the table with the expected population mortality
<- predictRS(object=splann, data=dataK,
datap ratetable=fr.ratetable, age="age", sex="sexchara", year="year")
# the predicted overall survival curves of the first 100 patients
plot(survfit(Surv(time/365.241, event) ~ 1, data = dataK),
ylab="Overall survival", xlab="Time (years)", conf.int = FALSE,
lwd=2, col="red")
for (i in 1:100) {
lines(x=datap$times/365.241, y=datap$ipredictions$overall_survival[i,],
col="gray", type="s") }
legend("topright", c("Kaplan-Meier estimator", "Individual predictions"),
col=c("red", "gray"), lty=c(1,1), lwd=c(2,1))
plot(survfit(Surv(time/365.241, event) ~ 1, data = dataK),
ylab="Overall survival", xlab="Time (years)",
lwd=1, col="black") # the non-parametric Kaplan-Meier estimator
lines(x=datap$times/365.241, y=datap$mpredictions$overall_survival,
col="red", type="s")
legend("topright", c("Kaplan-Meier estimator", "Mean of the individual predictions"),
col=c("black", "red"), lty=c(1,1), lwd=c(1,1))
<- rs.surv(Surv(time, event) ~ 1, data=dataK, ratetable=fr.ratetable,
fit_net rmap=list(age=age, sex= sex, year=year),
method = "pohar-perme") # the non-parametric Pohar-Perme estimator
plot(fit_net, col=1, lwd=1, lty=1, xscale = 365.241, xlab="Time (years)", ylim=c(0,1))
lines(x=datap$times, y=datap$mpredictions$net_survival,
type="s", col="red")
legend("topright", c("Pohar-Perme estimator", "Mean of the individual predictions"),
col=c("black", "red"), lty=c(1,1), lwd=c(1,1))
<- cmp.rel(Surv(time, event) ~ 1, data=dataK, ratetable=fr.ratetable,
cmp_fit rmap=list(age=age, sex= sex, year=year)) # the non-parametric Pohar-Perme estimator
plot(cmp_fit, col=c("black", "black"), lty=c(1,2), xscale = 365.241,
xlab="Time (years)", ylim=c(0,1))
lines(datap$times/365.241, datap$mpredictions$excess_cif, type="s", col="red", lty=1)
lines(datap$times/365.241, datap$mpredictions$population_cif, type="s", col="red", lty=2)
<- rs.surv(Surv(time, event) ~ 1, data=dataK, ratetable=fr.ratetable,
fit_sr rmap=list(age=age, sex= sex, year=year), method = "ederer1")
plot(fit_sr, col=1, lwd=1, lty=1, xscale = 365.241, xlab="Time (years)", ylim=c(0,1))
lines(x=datap$times, y=datap$mpredictions$relative_ratio_survival,
type="s", col="red")
legend("topright", c("Ederer-I estimator", "Mean of the individual predictions"),
col=c("black", "red"), lty=c(1,1), lwd=c(1,1))
To install the latest release from CRAN:
install.packages("survivalPLANN")
To install the development version from GitHub:
::install_github("chupverse/survivalPLANN") remotes
You can report any issues at this link.