data(RanEffdata)
set.seed(100)
x <- lapply(1:length(RanEffdata), function(i)
matrix(RanEffdata[[i]][, 2:3], ncol = 2))
x <- x[1:20]
y <- lapply(1:length(RanEffdata), function(i)
matrix(RanEffdata[[i]][, 1], ncol = 1))
y <- y[1:20]
lambda <- c(0.45, 0.55)
mu <- matrix(c(0, 4, 100, 12), 2, 2)
sigma <- 2
R <- list(diag(1, 2), diag(1, 2))
em.out <- regmixEM.mixed(y, x, sigma = sigma, arb.sigma = FALSE,
lambda = lambda, mu = mu, R = R,
addintercept.random = FALSE,
epsilon = 1e-02, verb = TRUE)
x.1 = em.out$x
n = sum(sapply(x.1, nrow))
x.1.sum = sum(sapply(1:length(x.1), function(i) length(x.1[[i]][,1])))
if (x.1.sum == n) {
x = lapply(1:length(x.1), function(i) matrix(x.1[[i]][,-1], ncol = 1))
} else {
x = x.1
}
plotly_post.beta(x = x, y = em.out$y, p.beta = em.out$posterior.beta,
p.z = em.out$posterior.z)
Run the code above in your browser using DataLab