Average of results replicas

Distribuzione Beta.gms (4.71 KB)
Hello,
after solving the model and applying it 4 times, I have to average the results of the 4 replicas (the results are represented by the variable z).

For each j, I have to get the average of the “z (l)”. I tried this way but I get the same result for all “j’s”. Can someone help me? Thanks so much.

Parameter mediaz(j);

mediaz(j) = sum(l0$(ord(l0)<card(l0)),z.l)/card(l0);

Hi

Your code just sums z l0 -1 times and divides it by the number of elements in l0. You could have just written

mediaz(j) = (card(l0) - 1 ) * z.l / card(l0)

You were probably looking for something like this:

mediaz(j) = sum(l0$(ord(l0)<card(j)),z.l)/card(l0);

This would at least give different results.
Cheers
Renger