## Not run:
# ####################################
# # A simulated Data Set
# # (Mixture of Normals)
# ####################################
#
# ind<-rbinom(100,1,0.5)
# vsim<-ind*rnorm(100,1,0.15)+(1-ind)*rnorm(100,3,0.15)
#
# x1<-rep(c(0,1),50)
# x2<-rnorm(100,0,1)
#
# etasim<-x1+-1*x2
# y<-etasim+vsim
#
#
# # Initial state
# state <- NULL
#
# # MCMC parameters
# nburn<-5000
# nsave<-10000
# nskip<-20
# ndisplay<-100
# mcmc <- list(nburn=nburn,nsave=nsave,nskip=nskip,
# ndisplay=ndisplay)
#
# # Prior information
# prior <- list(alpha=1,beta0=rep(0,3),Sbeta0=diag(1000,3),
# tau1=0.01,tau2=0.01,M=6)
#
# # Fit the model
#
# fit1 <- PTlm(formula=y~x1+x2,prior=prior,mcmc=mcmc,state=state,
# status=TRUE)
#
# # 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)
# plot(fit1,nfigr=2,nfigc=2)
#
# # Table of Pseudo Contour Probabilities
# anova(fit1)
#
#
# ############################################
# # The Australian Institute of Sport's data
# # (Skew data example)
# ############################################
# data(sports)
# attach(sports)
#
# # Initial state
# state <- NULL
#
# # MCMC parameters
#
# nburn<-5000
# nsave<-10000
# nskip<-20
# ndisplay<-100
# mcmc <- list(nburn=nburn,nsave=nsave,nskip=nskip,
# ndisplay=ndisplay)
#
# # Prior information
# prior <- list(alpha=1,beta0=rep(0,3),Sbeta0=diag(1000,3),
# tau1=0.01,tau2=0.01,M=8)
#
# # Fit the model
#
# fit2 <- PTlm(formula=bmi~lbm+gender,prior=prior,mcmc=mcmc,
# state=state,status=TRUE)
#
# # 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)
# plot(fit2,nfigr=2,nfigc=2)
#
# # Table of Pseudo Contour Probabilities
# anova(fit2)
#
# ## End(Not run)
Run the code above in your browser using DataLab