## Not run:
# # This example can be pasted into a script or copied into R to run. It
# # takes a few minutes, but illustrates how the code can be used
#
# data(IsraelPalestineConflict)
#
# # Find the mode of an msbvar model
# # Initial guess is based on random draw, so set seed.
# set.seed(123)
#
# xm <- msbvar(IsraelPalestineConflict, p=1, h=2,
# lambda0=0.8, lambda1=0.15,
# lambda3=2, lambda4=1, lambda5=0, mu5=0,
# mu6=0, qm=12,
# alpha.prior=matrix(c(100,40,30,50), 2, 2))
#
# # Plot out the initial mode
# plot(ts(xm$fp))
# print(xm$Q)
#
# # Now sample the posterior
# N1 <- 100
# N2 <- 500
#
# # First, so this with random permutation sampling
# x1 <- gibbs.msbvar(xm, N1=N1, N2=N2, permute=TRUE)
#
# # Identify the regimes using clustering in plotregimeid()
# plotregimeid(x1, type="all")
#
# # Now re-estimate based on desired regime identification seen in the
# # plots. Here we are using the variance of the first equation, so
# # Sigma.idx=1.
#
# x2 <- gibbs.msbvar(xm, N1=N1, N2=N2, permute=FALSE, Sigma.idx=1)
#
# # Plot the variances. Note the strict hyperplane between the variances
# # for the first equation versus the others.
# plotregimeid(xm, x2, type="Sigma")
# ## End(Not run)
Run the code above in your browser using DataLab