## 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)
Run the code above in your browser using DataLab