Reputation: 601
I am conducting a latent class analysis in R using the mclust package. I supplied codes for BIC to select the best fitting model or optimal number of classes, but noticed that the solution is not reproducible since it gives inconsistent output any time I rerun the same codes. For instance as shown below, I initially run the code and it yields a VVV model with 7 classes as the best fitting model. Other candidate best fitting models include VVV,6 and EVE, 8 (shown below):
I tried running the same code again and it suggests different best fitting models, i.e. EVE,9, EVE,8 and EVI,9 as reported below
My question is about how to resolve this problem to allow for reproducibility of results. I greatly appreciate any help on this.
Upvotes: 1
Views: 258
Reputation: 548
Are you setting your seed prior to running your code during testing? If not, use:
set.seed(42) # or whatever number you want...
this should allow you to get reproducible results.
Upvotes: 0