Skip to content
Prev 252411 / 398498 Next

Problem on flexmix when trying to apply signature developed in one model to a new sample

Jon,

if I did understand you correctly the problem is that you did not 
specify the newdata argument in posterior() correctly. You need to 
specify it in way such that evaluating the formula uses the correct 
object. If you have a matrix as dependent variable, you have to use a 
list which contains an object with the name of the dependent variable 
which contains the data you want to use for determining the a-posteriori 
probabilities. The same holds for clusters().

Have a look at the following code:

library("flexmix")
library("mvtnorm")
set.seed(123)
BM <- rbind(rmvnorm(100, rep(0, 2)),
             rmvnorm(100, rep(5, 2)))
ex2 <- flexmix(BM ~ 1, k = 2, model = FLXMCmvnorm(diagonal = FALSE))
print(ex2)
plotEll(ex2, BM)

Data2 <- data.frame(var1 = BM[c(1:5, 101:105), 1],
                     var2 = BM[c(1:5, 101:105), 2])
BM2 <- list(BM = cbind(Data2$var1, Data2$var2))
ProbMCI <- posterior(ex2, BM2)

HTH,
Bettina
On 03/01/2011 05:34 PM, Jon Toledo wrote: