Learn R Programming

DPpackage (version 1.1-4)

LDTFPsurvival: Survival Regression using Linear Dependent Tailfree Processes

Description

This function generates a posterior density sample for a Linear Dependent Tailfree Process model for conditional survival estimation of time-to-event data.

Usage

LDTFPsurvival(y,x,xtf,prediction,prior,mcmc,
              state,status,grid=seq(0.01,60,len=100),
              compute.band=FALSE,type.band="PD",
              data=sys.frame(sys.parent()),
              na.action=na.fail,work.dir=NULL)

Arguments

y
a vector giving the response variables.
x
a matrix giving the design matrix for the median function.
xtf
a matrix giving the design matrix for the conditional probabilities.
prediction
a list giving the information used to obtain conditional inferences. The list includes the following elements: xdenpred and xtfdenpred giving the design matrices for
prior
a list giving the prior information. The list includes the following parameter: maxn an integer giving the truncation of the tailfree process, a0 and b0 giving the hyperpara
mcmc
a list giving the MCMC parameters. The list must include the following elements: nburn an integer giving the number of burn-in scans, nskip an integer giving the thinning interval,
state
a list giving the current value of the parameters. This list is used if the current analysis is the continuation of a previous analysis.
status
a logical variable indicating whether this run is new (TRUE) or the continuation of a previous analysis (FALSE). In the latter case the current value of the parameters must be specifie
grid
vector of grid points where the conditional survival functions are evaluated. The default value is NULL and the grid is chosen according to the range of the data.
compute.band
logical variable indicating whether the credible band for the conditional density and mean function must be computed.
type.band
string indication the type of credible band to be computed; if equal to "HPD" or "PD" then the 95 percent pointwise HPD or PD band is computed, respectively.
data
data frame.
na.action
a function that indicates what should happen when the data contain NAs. The default action (na.fail) causes LDTFPsurvival to print an error message and terminate if there
work.dir
working directory.

Value

  • An object of class LDTFPsurvival representing the LDTFP model fit. Generic functions such as print, plot, and summary have methods to show the results of the fit. The results include beta, alpha and sigma^2. The list state in the output object contains the current value of the parameters necessary to restart the analysis. If you want to specify different starting values to run multiple chains set status=TRUE and create the list state based on this starting values. In this case the list state must include the following objects:
  • alphaa double precision giving the value of the precision parameter.
  • betacea vector giving the value of the median regression coefficient.
  • sigma^2a double precision giving the value of the centering variance.
  • betatfa matrix giving the regression coefficients for each conditional probability.
  • za vector giving the current value of the (imputed) survival times.

Details

This generic function fits a Linear Dependent Tailfree process (Jara and Hanson, 2011), for (potentially) interval-censored data. Let $T_i \in R^+$ be the time-to-event for subject i and set $z_i = \log T_i$. The model for the log time-to.event data is given by: $$z_i = x_i' \beta + v_i, i=1,\ldots,n$$ $$v_i | G_{xtf_i} \sim G_{xtfi}$$ $${G_{xtf}: xtf \in \mathcal{X} }| maxm,\alpha, \sigma^2 \sim LDTFP^{maxm}(h,\Pi^{\sigma^2},\textit{A}^{\alpha,\rho})$$ where, h is the logistic CDF, and $G_{xtf}$ is median-zero and centered around an $N(0,\sigma^2)$ distribution. To complete the model specification, independent hyperpriors are assumed, $$\alpha | a_0, b_0 \sim Gamma(a_0,b_0)$$ $$\sigma^{-2} | \tau_1, \tau_2 \sim Gamma(\tau_1/2,\tau_2/2)$$

The precision parameter, $\alpha$, of the LDTFP prior can be considered as random, having a gamma distribution, $Gamma(a_0,b_0)$, or fixed at some particular value. To let $\alpha$ to be fixed at a particular value, set $a_0$ to NULL in the prior specification.

The computational implementation of the model is based on Slice sampling (Neal, 2003).

References

Jara, A., Hanson, T. (2011). A class of mixtures of dependent tail-free processes. Biometrika, 98(3): 553 - 566.

Neal, R. (2003) Slice sampling. Anals of Statistics, 31: 705 - 767.

See Also

LDTFPdensity,LDDPsurvival

Examples

Run this code
#############################################################
   # Time to Cosmetic Deterioration of Breast Cancer Patients
   #############################################################

     data(deterioration)
     attach(deterioration)
     y <- cbind(left,right)
      
   # Design matrix

     x <- cbind(rep(1,length(trt)),trt)
     xtf <- cbind(rep(1,length(trt)),trt)
     colnames(x) <- c("(Intercept)","trt")
     colnames(xtf) <- c("(Intercept)","trt")
      
   # Prediction

     xdenpred <- cbind(rep(1,2),c(0,1))
     xtfdenpred <- cbind(rep(1,2),c(0,1))
     xmedpred <- cbind(rep(1,2),c(0,1))
     xtfmedpred <- cbind(rep(1,2),c(0,1))

     prediction <- list(xdenpred=xdenpred,
                        xtfdenpred=xtfdenpred,
                        xmedpred=xmedpred,
                        xtfmedpred=xtfmedpred,
                        quans=c(0.03,0.50,0.97))

   # Prior information

     prior <- list(maxm=5,
                   a0=1,
                   b0=1,
                   mub=rep(0,2),
                   Sb=diag(1000,2),
                   tau1=2,002,
                   tau2=2.002)

   # Initial state
     state <- NULL

   # MCMC parameters

     mcmc <- list(nburn=5000,
                  nsave=5000,
                  nskip=4,
                  ndisplay=200)

   # Fitting the model
 
     fit1 <- LDTFPsurvival(y=y,
                           x=x,
                           xtf=xtf,
                           prediction=prediction,
                           prior=prior, 
                           mcmc=mcmc,     
                           state=state,
                           grid=seq(0.01,70,len=200),
                           status=TRUE,
                           compute.band=TRUE)

     fit1
     summary(fit1)
     plot(fit1)

   # Plotting survival functions estimates
 
     par(cex=1.7,mar=c(4.1, 4.1, 1, 1))
     x1 <- fit1$grid
     y1 <- fit1$survml[1,]
     x2 <- fit1$grid
     y2 <- fit1$survmu[1,]
     aa <- rbind(x2,y2)[, order(-x2, y2)]
     x2 <- aa[1,]
     y2 <- aa[2,]
     plot(fit1$grid,fit1$survmu[1,],type="l",
          xlab="months",ylab="survival",
          lty=1,lwd=2,ylim=c(0,1),col="lightgray")
     polygon(x=c(x1,x2),y=c(y1,y2),border=NA,col="lightgray")
     lines(fit1$grid,fit1$survmm[1,],lty=1,lwd=3)

     par(cex=1.7,mar=c(4.1, 4.1, 1, 1))
     x1 <- fit1$grid
     y1 <- fit1$survml[2,] 
     x2 <- fit1$grid
     y2 <- fit1$survmu[2,]
     aa <- rbind(x2,y2)[, order(-x2, y2)]
     x2 <- aa[1,]
     y2 <- aa[2,]
     plot(fit1$grid,fit1$survmu[2,],type="l",
          xlab="months",ylab="survival",
          lty=1,lwd=2,ylim=c(0,1),col="lightgray")
     polygon(x=c(x1,x2),y=c(y1,y2),border=NA,col="lightgray")
     lines(fit1$grid,fit1$survmm[2,],lty=1,lwd=3)

Run the code above in your browser using DataLab