# NOT RUN {
m <- 2
d <- 3
x <- list(m = m,
d = d,
pie = c(0.5, 0.5),
mu = list(comp1=rep(0,d), comp2=rep(1,d)),
sigma = list(comp1=diag(d), comp2=diag(d)))
print(x)
theta <- as.theta(x)
print(theta)
x2 <- unname(list( # Unnamed
# missing m and d
pie = c(1, 1), # Does not sum to 1
mu = simplify2array(list(comp1=rep(0,d), comp2=rep(1,d))), # matrix, not a list
sigma = simplify2array(list(comp1=diag(d), comp2=diag(d))) # array, not a list
))
theta2 <- as.theta(x2)
print(theta2)
# }
Run the code above in your browser using DataLab