Title: | The Generalized Time-Dependent Logistic Family |
---|---|
Description: | Computes the probability density, survival function, the hazard rate functions and generates random samples from the GTDL distribution given by Mackenzie, G. (1996) <doi:10.2307/2348408>. The likelihood estimates, the randomized quantile (Louzada, F., et al. (2020) <doi:10.1109/ACCESS.2020.3040525>) residuals and the normally transformed randomized survival probability (Li,L., et al. (2021) <doi:10.1002/sim.8852>) residuals are obtained for the GTDL model. |
Authors: | Jalmar Carrasco [aut, cre], Luciano Santana [aut], Lizandra Fabio [aut] |
Maintainer: | Jalmar Carrasco <[email protected]> |
License: | GPL (>=3) |
Version: | 1.0.0 |
Built: | 2025-03-05 03:15:49 UTC |
Source: | https://github.com/carrascojalmar/gtdl |
Times to failure of 50 devices put on life test at time 0.
data(artset1987)
data(artset1987)
This data frame contains the following columns:
t: Times to failure
Aarset, M. V. (1987). How to Identify a Bathtub Hazard Rate. IEEE Transactions on Reliability, 36, 106–108.
data(artset1987) head(artset1987)
data(artset1987) head(artset1987)
Density function, survival function, failure function and random generation for the GTDL distribution.
dGTDL(t, param, log = FALSE) hGTDL(t, param) sGTDL(t, param) rGTDL(n, param)
dGTDL(t, param, log = FALSE) hGTDL(t, param) sGTDL(t, param) rGTDL(n, param)
t |
vector of integer positive quantile. |
param |
parameters (alpha and gamma are scalars, lambda non-negative). |
log |
logical; if TRUE, probabilities p are given as log(p). |
n |
number of observations. |
Density function
Survival function
Failure function
dGTDL
gives the density function, hGTDL
gives the failure function, sGTDL
gives the survival function and rGTDL
generates random samples.
Invalid arguments will return an error message.
[d-p-q-r]GTDL are calculated directly from the definitions.
Mackenzie, G. (1996). Regression Models for Survival Data: The Generalized Time-Dependent Logistic Family. Journal of the Royal Statistical Society. Series D (The Statistician). 45. 21-34.
library(GTDL) t <- seq(0,20,by = 0.1) lambda <- 1.00 alpha <- -0.05 gamma <- -1.00 param <- c(lambda,alpha,gamma) y1 <- hGTDL(t,param) y2 <- sGTDL(t,param) y3 <- dGTDL(t,param,log = FALSE) tt <- as.matrix(cbind(t,t,t)) yy <- as.matrix(cbind(y1,y2,y3)) matplot(tt,yy,type="l",xlab="time",ylab="",lty = 1:3,col=1:3,lwd=2) y1 <- hGTDL(t,c(1,0.5,-1.0)) y2 <- hGTDL(t,c(1,0.25,-1.0)) y3 <- hGTDL(t,c(1,-0.25,1.0)) y4 <- hGTDL(t,c(1,-0.50,1.0)) y5 <- hGTDL(t,c(1,-0.06,-1.6)) tt <- as.matrix(cbind(t,t,t,t,t)) yy <- as.matrix(cbind(y1,y2,y3,y4,y5)) matplot(tt,yy,type="l",xlab="time",ylab="Hazard function",lty = 1:3,col=1:3,lwd=2)
library(GTDL) t <- seq(0,20,by = 0.1) lambda <- 1.00 alpha <- -0.05 gamma <- -1.00 param <- c(lambda,alpha,gamma) y1 <- hGTDL(t,param) y2 <- sGTDL(t,param) y3 <- dGTDL(t,param,log = FALSE) tt <- as.matrix(cbind(t,t,t)) yy <- as.matrix(cbind(y1,y2,y3)) matplot(tt,yy,type="l",xlab="time",ylab="",lty = 1:3,col=1:3,lwd=2) y1 <- hGTDL(t,c(1,0.5,-1.0)) y2 <- hGTDL(t,c(1,0.25,-1.0)) y3 <- hGTDL(t,c(1,-0.25,1.0)) y4 <- hGTDL(t,c(1,-0.50,1.0)) y5 <- hGTDL(t,c(1,-0.06,-1.6)) tt <- as.matrix(cbind(t,t,t,t,t)) yy <- as.matrix(cbind(y1,y2,y3,y4,y5)) matplot(tt,yy,type="l",xlab="time",ylab="Hazard function",lty = 1:3,col=1:3,lwd=2)
Estimate of the parameters.
mle1.GTDL(start, t, method = "BFGS")
mle1.GTDL(start, t, method = "BFGS")
start |
Initial values for the parameters to be optimized over. |
t |
non-negative random variable representing the failure time and leave the snapshot failure rate, or danger. |
method |
The method to be used. |
Returns a list of summary statistics of the fitted GTDL distribution.
Aarset, M. V. (1987). How to Identify a Bathtub Hazard Rate. IEEE Transactions on Reliability, 36, 106–108.
Mackenzie, G. (1996) Regression Models for Survival Data: The Generalized Time-Dependent Logistic Family. Journal of the Royal Statistical Society. Series D (The Statistician). 45. 21-34.
# times data (from Aarset, 1987)) data(artset1987) mod <- mle1.GTDL(c(1,-0.05,-1),t = artset1987)
# times data (from Aarset, 1987)) data(artset1987) mod <- mle1.GTDL(c(1,-0.05,-1),t = artset1987)
Maximum likelihood estimates of the GTDL model
mle2.GTDL(t, start, formula, censur, method = "BFGS")
mle2.GTDL(t, start, formula, censur, method = "BFGS")
t |
non-negative random variable representing the failure time and leave the snapshot failure rate, or danger. |
start |
Initial values for the parameters to be optimized over. |
formula |
The structure matrix of covariates of dimension n x p. |
censur |
censoring status 0=censored, a=fail. |
method |
The method to be used. |
Returns a list of summary statistics of the fitted GTDL model.
Mackenzie, G. (1996) Regression Models for Survival Data: The Generalized Time-Dependent Logistic Family. Journal of the Royal Statistical Society. Series D (The Statistician). (45). 21-34.
### Example 1 require(survival) data(lung) lung <- lung[-14,] lung$sex <- ifelse(lung$sex==2, 1, 0) lung$ph.ecog[lung$ph.ecog==3]<-2 t1 <- lung$time start1 <- c(0.03,0.05,-1,0.7,2,-0.1) formula1 <- ~lung$sex+factor(lung$ph.ecog)+lung$age censur1 <- ifelse(lung$status==1,0,1) fit.model1 <- mle2.GTDL(t = t1,start = start1, formula = formula1, censur = censur1) fit.model1 ### Example 2 data(tumor) t2 <- tumor$time start2 <- c(1,-0.05,1.7) formula2 <- ~tumor$group censur2 <- tumor$censured fit.model2 <- mle2.GTDL(t = t2,start = start2, formula = formula2, censur = censur2) fit.model2
### Example 1 require(survival) data(lung) lung <- lung[-14,] lung$sex <- ifelse(lung$sex==2, 1, 0) lung$ph.ecog[lung$ph.ecog==3]<-2 t1 <- lung$time start1 <- c(0.03,0.05,-1,0.7,2,-0.1) formula1 <- ~lung$sex+factor(lung$ph.ecog)+lung$age censur1 <- ifelse(lung$status==1,0,1) fit.model1 <- mle2.GTDL(t = t1,start = start1, formula = formula1, censur = censur1) fit.model1 ### Example 2 data(tumor) t2 <- tumor$time start2 <- c(1,-0.05,1.7) formula2 <- ~tumor$group censur2 <- tumor$censured fit.model2 <- mle2.GTDL(t = t2,start = start2, formula = formula2, censur = censur2) fit.model2
Normally-transformed randomized survival probability residuals for the GTDL model
nrsp.GTDL(t, formula, pHat, censur)
nrsp.GTDL(t, formula, pHat, censur)
t |
non-negative random variable representing the failure time and leave the snapshot failure rate, or danger. |
formula |
The structure matrix of covariates of dimension n x p. |
pHat |
Estimate of the parameters from the GTDL model. |
censur |
Censoring status 0=censored, a=fail. |
Normally-transformed randomized survival probability residuals
Li, L., Wu, T., e Cindy, F. (2021). Model diagnostics for censored regression via randomized survival probabilities. Statistics in Medicine, 40, 1482–1497.
de Oliveira, L. E. F., dos Santos L. S., da Silva, P. H. F., Fabio, L. C., Carrasco, J. M. F.(2022). Análise de resíduos para o modelo logístico generalizado dependente do tempo (GTDL). Submitted.
### Example 1 require(survival) data(lung) lung <- lung[-14,] lung$sex <- ifelse(lung$sex==2, 1, 0) lung$ph.ecog[lung$ph.ecog==3]<-2 t1 <- lung$time formula1 <- ~lung$sex+factor(lung$ph.ecog)+lung$age censur1 <- ifelse(lung$status==1,0,1) start1 <- c(0.03,0.05,-1,0.7,2,-0.1) fit.model1 <- mle2.GTDL(t = t1,start = start1, formula = formula1, censur = censur1) r1 <- nrsp.GTDL(t = t1,formula = formula1 ,pHat = fit.model1$Coefficients[,1], censur = censur1) r1 ### Example 2 data(tumor) t2 <- tumor$time formula2 <- ~tumor$group censur2 <- tumor$censured start2 <- c(1,-0.05,1.7) fit.model2 <- mle2.GTDL(t = t2,start = start2, formula = formula2, censur = censur2) r2 <- nrsp.GTDL(t = t2,formula = formula2, pHat = fit.model2$Coefficients[,1], censur = censur2) r2
### Example 1 require(survival) data(lung) lung <- lung[-14,] lung$sex <- ifelse(lung$sex==2, 1, 0) lung$ph.ecog[lung$ph.ecog==3]<-2 t1 <- lung$time formula1 <- ~lung$sex+factor(lung$ph.ecog)+lung$age censur1 <- ifelse(lung$status==1,0,1) start1 <- c(0.03,0.05,-1,0.7,2,-0.1) fit.model1 <- mle2.GTDL(t = t1,start = start1, formula = formula1, censur = censur1) r1 <- nrsp.GTDL(t = t1,formula = formula1 ,pHat = fit.model1$Coefficients[,1], censur = censur1) r1 ### Example 2 data(tumor) t2 <- tumor$time formula2 <- ~tumor$group censur2 <- tumor$censured start2 <- c(1,-0.05,1.7) fit.model2 <- mle2.GTDL(t = t2,start = start2, formula = formula2, censur = censur2) r2 <- nrsp.GTDL(t = t2,formula = formula2, pHat = fit.model2$Coefficients[,1], censur = censur2) r2
Randomized quantile residuals for the GTDL model
random.quantile.GTDL(t, formula, pHat, censur)
random.quantile.GTDL(t, formula, pHat, censur)
t |
non-negative random variable representing the failure time and leave the snapshot failure rate, or danger. |
formula |
The structure matrix of covariates of dimension n x p. |
pHat |
Estimate of the parameters from the GTDL model. |
censur |
censoring status 0=censored, a=fail. |
The randomized quantile residual (Dunn and Smyth, 1996), which follow a standard normal distribution is used to assess departures from the GTDL model.
Randomized quantile residuals
Dunn, P. K. e Smyth, G. K. (1996). Randomized quantile residuals. Journal of Computational and Graphical Statistics, 5, 236–244.
Louzada, F., Cuminato, J. A., Rodriguez, O. M. H., Tomazella, V. L. D., Milani, E. A., Ferreira, P. H., Ramos, P. L., Bochio, G., Perissini, I. C., Junior, O. A. G., Mota, A. L., Alegr´ıa, L. F. A., Colombo, D., Oliveira, P. G. O., Santos, H. F. L., e Magalh˜aes, M. V. C. (2020). Incorporation of frailties into a non-proportional hazard regression model and its diagnostics for reliability modeling of downhole safety valves. IEEE Access, 8, 219757 – 219774.
de Oliveira, L. E. F., dos Santos L. S., da Silva, P. H. F., Fabio, L. C., Carrasco, J. M. F.(2022). Análise de resíduos para o modelo logístico generalizado dependente do tempo (GTDL). Submitted.
### Example 1 require(survival) data(lung) lung <- lung[-14,] lung$sex <- ifelse(lung$sex==2, 1, 0) lung$ph.ecog[lung$ph.ecog==3]<-2 t1 <- lung$time formula1 <- ~lung$sex+factor(lung$ph.ecog)+lung$age censur1 <- ifelse(lung$status==1,0,1) start1 <- c(0.03,0.05,-1,0.7,2,-0.1) fit.model1 <- mle2.GTDL(t = t1,start = start1, formula = formula1, censur = censur1) r1 <- random.quantile.GTDL(t = t1,formula = formula1 ,pHat = fit.model1$Coefficients[,1], censur = censur1) r1 ### Example 2 data(tumor) t2 <- tumor$time formula2 <- ~tumor$group censur2 <- tumor$censured start2 <- c(1,-0.05,1.7) fit.model2 <- mle2.GTDL(t = t2,start = start2, formula = formula2, censur = censur2) r2 <- random.quantile.GTDL(t = t2,formula = formula2, pHat = fit.model2$Coefficients[,1], censur = censur2) r2
### Example 1 require(survival) data(lung) lung <- lung[-14,] lung$sex <- ifelse(lung$sex==2, 1, 0) lung$ph.ecog[lung$ph.ecog==3]<-2 t1 <- lung$time formula1 <- ~lung$sex+factor(lung$ph.ecog)+lung$age censur1 <- ifelse(lung$status==1,0,1) start1 <- c(0.03,0.05,-1,0.7,2,-0.1) fit.model1 <- mle2.GTDL(t = t1,start = start1, formula = formula1, censur = censur1) r1 <- random.quantile.GTDL(t = t1,formula = formula1 ,pHat = fit.model1$Coefficients[,1], censur = censur1) r1 ### Example 2 data(tumor) t2 <- tumor$time formula2 <- ~tumor$group censur2 <- tumor$censured start2 <- c(1,-0.05,1.7) fit.model2 <- mle2.GTDL(t = t2,start = start2, formula = formula2, censur = censur2) r2 <- random.quantile.GTDL(t = t2,formula = formula2, pHat = fit.model2$Coefficients[,1], censur = censur2) r2
Times (in days) of patients in ovarian cancer study
data(tumor)
data(tumor)
This data frame contains the following columns:
time: survival time in days
censured: censored = 0, dead = 1
group: large tumor = 0, small tumor = 1
Colosimo, E. A and Giolo, S. R. Análise de Sobrevivência Aplicada. Edgard Blucher: São Paulo. 2006.
data(tumor) head(tumor)
data(tumor) head(tumor)