Originally posted by Mengmeng Li
View Post
To store the 100 log-likelihoods in the matrix a, you need the loop to cover 100 random seeds, e.g.
Code:
forvalue seed = 1/100 { gsem (glucose insulin sspg <- _cons), lclass(C 5) /// startvalues(jitter, draws(1) seed(`seed')) emopts(iter(20) matrix a = a \ e(ll) estimates store c5_`seed' } matrix list a
The way you wrote your command, you pass a random number seed through to the command 100 times, but each time, it makes also 100 random draws (and then it runs 20 EM iterations, then goes back, then when done it will use Newton Raphson from the draw with the highest log likelihood). So, your command actually runs 100^2 start values, but only stores 100.
Comment