library(BAYSTAR) data(unemployrate) x <- unemployrate nx <- length(x) dif.x <- x[2:nx]-x[2:nx-1] lagp1 <- c(2,3,4,10,12) lagp2 <- c(2,3,12) ## Total MCMC iterations and burn-in iterations Iteration <- 10000 Burnin <- 2000 ## A RW (random walk) MH algorithm is used in simulating the threshold value ## Step size for the RW MH step.thv<- 2.5 out <- BAYSTAR(dif.x,lagp1,lagp2,Iteration,Burnin,constant=0,step.thv=step.thv) # Geweke's Convergence Diagnostic library(coda) geweke.diag(out$posterior, frac1=0.1, frac2=0.5) ## Model Comparison. Assume maximum lag d0 = 4 now d0 <- 4 out2 <- BAYSTAR(dif.x,lagp1,lagp2,Iteration,Burnin,d0,constant=0,step.thv=step.thv) geweke.diag(out2$posterior, frac1=0.1, frac2=0.5)