Learn R Programming

DPpackage (version 1.1-0)

DPsurvint: Bayesian analysis for a semiparametric AFT regression model

Description

This function generates a posterior density sample from a semiparametric AFT regression model for interval-censored data.

Usage

DPsurvint(formula,prior,mcmc,state,status,
          data=sys.frame(sys.parent()),na.action=na.fail)

Arguments

formula
a two-sided linear formula object describing the model fit, with the response on the left of a ~ operator and the terms, separated by + operators, on the right. In
prior
a list giving the prior information. The list includes the following parameter: a0 and b0 giving the hyperparameters for prior distribution of the precision parameter of the Dirichlet p
mcmc
a list giving the MCMC parameters. The list must include the following integers: nburn giving the number of burn-in scans, nskip giving the thinning interval, nsave giving
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
data
data frame.
na.action
a function that indicates what should happen when the data contain NAs. The default action (na.fail) causes DPsurvint to print an error message and terminate if there are

Value

  • An object of class DPsurvint representing the semiparametric AFT regression model fit. Generic functions such as print, plot, summary, and anova have methods to show the results of the fit. The results include beta, mu, sigma, the precision parameter alpha, and the number of clusters. The function predict.DPsurvint can be used to extract posterior information of the survival curve. 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:
  • betagiving the value of the regression coefficients.
  • vgiving the value of the errors (it must be consistent with the data.
  • mugiving the mean of the lognormal baseline distribution.
  • sigmagiving the variance of the lognormal baseline distribution.
  • alphagiving the value of the precision parameter.

Details

This generic function fits a Mixture of Dirichlet process in a AFT regression model for interval censored data (Hanson and Johnson, 2004): $$T_i = exp(- X_i \beta) V_i, i=1,\ldots,n$$ $$\beta | \beta_0, S_{\beta_0} \sim N(\beta_0,S_{\beta_0})$$ $$V_i | G \sim G$$ $$G | \alpha, G_0 \sim DP(\alpha G_0)$$ where, $G_0 = Log Normal(V| \mu, \sigma)$. To complete the model specification, independent hyperpriors are assumed, $$\alpha | a_0, b_0 \sim Gamma(a_0,b_0)$$ $$\mu | m_0, s_0 \sim N(m_0,s_0)$$ $$\sigma^{-1} | \tau_1, \tau_2 \sim Gamma(\tau_1/2,\tau_2/2)$$ The precision or total mass parameter, $\alpha$, of the DP prior can be considered as random, having a gamma distribution, $Gamma(a_0,b_0)$, or fixed at some particular value. When $\alpha$ is random the method described by Escobar and West (1995) is used. To let $\alpha$ to be fixed at a particular value, set $a_0$ to NULL in the prior specification. In the computational implementation of the model, $G$ is considered as latent data and sampled partially with sufficient accuracy to be able to generate $V_1,\ldots,V_{n+1}$ which are exactly iid $G$, as proposed by Doss (1994). Both Ferguson's definition of DP and the Sethuraman-Tiwari (1982) representation of the process are used, as described in Hanson and Johnson (2004) to allow the inclusion of covariates. A Metropolis-Hastings step is used to sample the fully conditional distribution of the regression coefficients and errors (see, Hanson and Johnson, 2004). An extra step which moves the clusters in such a way that the posterior distribution is still a stationary distribution, is performed in order to improve the rate of mixing.

References

Doss, H. (1994). Bayesian nonparametric estimation for incomplete data using mixtures of Dirichlet priors. The Annals of Statistics, 22: 1763 - 1786. Escobar, M.D. and West, M. (1995) Bayesian Density Estimation and Inference Using Mixtures. Journal of the American Statistical Association, 90: 577-588. Hanson, T., and Johnson, W. (2004) A Bayesian Semiparametric AFT Model for Interval-Censored Data. Journal of Computational and Graphical Statistics, 13: 341-361. Sethuraman, J., and Tiwari, R. C. (1982) Convergence of Dirichlet Measures and the Interpretation of their Parameter, in Statistical Decision Theory and Related Topics III (vol. 2), eds. S. S. Gupta and J. O. Berger, New York: Academic Press, pp. 305 - 315.

See Also

predict.DPsurvint

Examples

Run this code
####################################
    # A simulated Data Set
    ####################################
     ind<-rbinom(100,1,0.5)
     vsim<-ind*rnorm(100,1,0.25)+(1-ind)*rnorm(100,3,0.25)
     x1<-rep(c(0,1),50)
     x2<-rnorm(100,0,1)
     etasim<-x1+-1*x2
     time<-vsim*exp(-etasim)
     y<-matrix(-999,nrow=100,ncol=2)
     for(i in 1:100){
        for(j in 1:15){
         if((j-1)<time[i] & time[i]<=j){
            y[i,1]<-j-1
            y[i,2]<-j
         }
     }
     if(time[i]>15)y[i,1]<-15
     }

    # Initial state
      state <- NULL

    # MCMC parameters

      nburn<-20000
      nsave<-10000
      nskip<-10
      ndisplay<-100
      mcmc <- list(nburn=nburn,nsave=nsave,nskip=nskip,
                   ndisplay=ndisplay,tune=0.125)

    # Prior information
      prior <- list(alpha=1,beta0=rep(0,2),Sbeta0=diag(1000,2),
                    m0=0,s0=1,tau1=0.01,tau2=0.01)


    # Fit the model

      fit1 <- DPsurvint(y~x1+x2,prior=prior,mcmc=mcmc,
                        state=state,status=TRUE) 
      fit1

    # Summary with HPD and Credibility intervals
      summary(fit1)
      summary(fit1,hpd=FALSE)

    # Plot model parameters 
    # (to see the plots gradually set ask=TRUE)
      plot(fit1,ask=FALSE)
      plot(fit1,ask=FALSE,nfigr=2,nfigc=2)	

    # Plot an specific model parameter 
    # (to see the plots gradually set ask=TRUE)
      plot(fit1,ask=FALSE,nfigr=1,nfigc=2,param="x1")	
      plot(fit1,ask=FALSE,nfigr=1,nfigc=2,param="mu")	

    # Table of Pseudo Contour Probabilities
      anova(fit1)      

    # Predictive information with covariates
      npred<-10
      xnew<-cbind(rep(1,npred),seq(-1.5,1.5,length=npred))
      xnew<-rbind(xnew,cbind(rep(0,npred),seq(-1.5,1.5,length=npred)))
      grid<-seq(0.00001,14,0.5)
      pred1<-predict(fit1,xnew=xnew,grid=grid)

    # Plot Baseline information
      plot(pred1,all=FALSE,band=TRUE)


    #############################################################
    # Time to Cosmetic Deterioration of Breast Cancer Patients
    #############################################################

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

    # Initial state
      state <- NULL

    # MCMC parameters

      nburn<-20000
      nsave<-10000
      nskip<-20
      ndisplay<-1000
      mcmc <- list(nburn=nburn,nsave=nsave,nskip=nskip,
                   ndisplay=ndisplay,tune=0.25)

    # Prior information
      prior <- list(alpha=10,beta0=rep(0,1),Sbeta0=diag(100,1),
                    m0=0,s0=1,tau1=0.01,tau2=0.01)

    # Fitting the model

      fit2 <- DPsurvint(y~trt,prior=prior,mcmc=mcmc,
                        state=state,status=TRUE) 
      fit2
      
    # Summary with HPD and Credibility intervals
      summary(fit2)
      summary(fit2,hpd=FALSE)

    # Plot model parameters 
    # (to see the plots gradually set ask=TRUE)
      plot(fit2)

    # Table of Pseudo Contour Probabilities
      anova(fit2)      

    # Predictive information with covariates
      xnew<-matrix(c(0,1),nrow=2,ncol=1)
      grid<-seq(0.01,70,1)
      pred2<-predict(fit2,xnew=xnew,grid=grid)
      plot(pred2,all=FALSE,band=TRUE)

Run the code above in your browser using DataLab