predict.DPsurvint {DPpackage} | R Documentation |
This function generates a posterior density sample of the Survival curve from a semiparametric AFT regression model for interval-censored data.
## S3 method for class 'DPsurvint': predict(object,grid,xnew=NULL,hpd=TRUE, ...)
object |
DPsurvint fitted model object. |
grid |
a vector of grid points where the survival curve should be evaluated. |
xnew |
an optional matrix containing the value of the covariables with which to predict. If omitted, the baseline survival information is calculated. |
hpd |
a logical variable indicating whether a 95HPD interval is
calculated, TRUE , or a 95Credibility interval is
caculated, FALSE , for the survival curve at each grid point.
The default value is TRUE . |
... |
further arguments to be passed. |
This function computes the survival curve based on the fit of a Mixture of Dirichlet process in a AFT regression model for interval censored data (Hanson and Johnson, 2004).
Given a MCMC sample of size J of the parameters, a sample of the predictive survival curve for X is drawn as follows: for the MCMC scan j of the posterior distribution, with j=1,...,J, we sample from:
S^{(j)}(t|X,data) ~ Beta(a^{(j)}(t),b^{(j)}(t))
where,
a^{(j)}(t)=α^{(j)} G_0^{(j)}( (t exp(X β^{(j)}) , infty) ) + sum_{i=1}^n delta_{V^{(j)}_i} ( (t exp(X β^{(j)}) , infty) )
and
b^{(j)}(t)=α^{(j)}+N - a^{(j)}(t)
An object of class predict.DPsurvint
representing the survival information
arising from a DPsurvint
model fit. The results include the posterior mean (pmean
),
the posterior median (pmedian
), the posterior standard deviation (psd
),
the naive standard error (pstd
) and the limits of the HPD or credibility intervals,
plinf
and plsup
.
Alejandro Jara <ajarav@udec.cl>
Doss, H. (1994). Bayesian nonparametric estimation for incomplete data using mixtures of Dirichlet priors. The Annals of Statistics, 22: 1763 - 1786.
Hanson, T., and Johnson, W. (2004) A Bayesian Semiparametric AFT Model for Interval-Censored Data. Journal of Computational and Graphical Statistics, 13: 341-361.
## Not run: #################################### # 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<-5000 nsave<-10000 nskip<-10 ndisplay<-50 mcmc <- list(nburn=nburn,nsave=nsave,nskip=nskip, ndisplay=ndisplay,tune=0.125) # Prior information prior <- list(alpha=10,beta0=rep(0,2),Sbeta0=diag(100000,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 plot(fit1) plot(fit1,nfigr=2,nfigc=2) # Plot an specific model parameter plot(fit1,ask=FALSE,nfigr=1,nfigc=2,param="x1") plot(fit1,ask=FALSE,nfigr=1,nfigc=2,param="mu") # Predictive information for baseline survival grid<-seq(0.00001,14,0.5) pred<-predict(fit1,grid=grid) # Plot Baseline information with and without Credibility band plot(pred) plot(pred,band=TRUE) # 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) pred<-predict(fit1,xnew=xnew,grid=grid) # Plot Baseline information plot(pred,band=TRUE) ## End(Not run)