Am 02.10.2021 um 07:47 schrieb Alecos Papadopoulos:
Good morning.
I have a likelihood computed by applying quadrature twice, in a
double-sum way. I can compute the inner sum and then use an index
loop to compute the outer sum and the whole likelihood.
My questions are
a) Can I include a loop inside an mle command? My impression is, "no".
You're probably right (still would be useful just to try it). But you
could wrap the loop in a function which you then call inside the MLE
block. I don't see why that wouldn't work, and it would probably be
cleaner anyway. An example for a user-defined function that is called
inside 'mle' is in section 26.8 of the guide: the 'score' function there.
b) If I write the computation of the likelihood in a user-defined
function, can I include this function in an mle command?
Yes - see in that guide
chapter the example with the ln_zip_prob function.
hth,
sven