## Not run:
#
# # Data
# data(calgb)
# attach(calgb)
# y <- cbind(Z1,Z2,Z3,T1,T2,B0,B1)
#
# # Prior information
# prior <- list(pe1=0.1,
# pe0=0.1,
# ae=1,
# be=1,
# a0=rep(1,3),
# b0=rep(1,3),
# nu=9,
# tinv=0.25*var(y),
# m0=apply(y,2,mean),
# S0=var(y),
# nub=9,
# tbinv=var(y))
#
#
# # Initial state
# state <- NULL
#
# # MCMC parameters
#
# mcmc <- list(nburn=5000,
# nsave=5000,
# nskip=3,
# ndisplay=100)
#
# # Fitting the model
# fit1 <- HDPMdensity(y=y,
# study=study,
# prior=prior,
# mcmc=mcmc,
# state=state,
# status=TRUE)
#
# # Posterior inference
# fit1
# summary(fi1)
#
# # Plot the parameters
# # (to see the plots gradually set ask=TRUE)
# plot(fit1,ask=FALSE)
#
# # Plot the a specific parameters
# # (to see the plots gradually set ask=TRUE)
# plot(fit1,ask=FALSE,param="eps",nfigr=1,nfigc=2)
#
# # Plot the measure for each study
# predict(fit1,i=1,r=1) # study 1
# predict(fit1,i=2,r=1) # study 2
#
# # Plot the idiosyncratic measure for each study
# predict(fit1,i=1,r=0) # study 1
# predict(fit1,i=2,r=0) # study 2
#
# # Plot the common measure
# predict(fit1,i=0)
# ## End(Not run)
Run the code above in your browser using DataLab