# \donttest{
# Generate data that has two series, each with 100 observations
y1 <- replicate(25, rnorm(4, c(-1, 0, 1, 2), c(0.1, 0.25, 0.5, 0.75)))
y2 <- replicate(25, rnorm(4, c(2, 1, 0, -2), c(0.1, 0.25, 0.5, 0.75)))
y <- rbind(c(t(y1)), c(t(y2)))
n <- ncol(y)
# Marginal likelihood parameters
thetas <- matrix(1, nrow = 2, ncol = 4)
thetas[1,] <- c(0, 1, 2, 1)
thetas[2,] <- c(0, 1, 2, 1)
# Fit the Bayesian ppm change point model
fit <- icp_ppm(ydata = y,
a0 = c(1, 1),
b0 = c(1, 1),
mltypes = c(1, 1),
thetas = thetas,
nburn = 1000, nskip = 1, nsave = 1000)
cpprobsL <- matrix(apply(fit$C,2,mean), nrow=n-1, byrow=FALSE)
# }
Run the code above in your browser using DataLab