I'm a bit confused about what you're trying to do. You have an outer
K loop, which looks like that's looping over experiments, but what's the
I loop inside that supposed to do? As written it doesn't do anything but define and redefine a set of FRMLs. Since the MAXIMIZE is after the end of that loop, only the final value of I will matter.
Both for readability and also to make it easier to spot errors, you should pull anything that doesn't change with a trip through the loop outside of it. For instance, this whole block
- Code: Select all
compute lambda01s = (muTs-muxs)/sqrt(sigmaT1s^2-((sigmax1s)^(-2)*sigmaTx1s^2))
compute lambda02s = (muTs-muxs)/sqrt(sigmaT2s^2-((sigmax2s)^(-2)*sigmaTx2s^2))
compute lambda11s = -sigmax1s*(1-(sigmax1s)^(-2)*sigmaTx1s)/sqrt(sigmaT1s^2-((sigmax1s)^(-2)*(sigmaTx1s)^2))
compute lambda12s = -sigmax2s*(1-(sigmax2s)^(-2)*sigmaTx2s)/sqrt(sigmaT2s^2-((sigmax2s)^(-2)*(sigmaTx2s)^2))
compute as = -lambda01s/sqrt(1+lambda11s^2)
compute bs = -lambda02s/sqrt(1+lambda12s^2)
compute cs = 1/sqrt(1+lambda11s^2)
compute ds = 1/sqrt(1+lambda12s^2)
compute g3s = (muTs-muxs)/sqrt(sigmaT1s^2+sigmax1s^2+(-2)*sigmaTx1s)
compute g4s = (muxs-muTs)/sqrt(sigmaT2s^2+sigmax2s^2+(-2)*sigmaTx2s)
compute ps = %cdf(g3s)/(%cdf(g3s)+%cdf(g4s))
appears to be fixed across experiments, so should be pulled outside the K loop.