I’d like to keep the structure of a for
loop because I have something like this:
function func(R)
b = zero(paramvec)
for i in 1:R
sdata = datasimulator() # returns a vector of data
b += estimatemodel(sdata) # returns a vector of parameters
end
avgb = b ./ R # averages parameters across simulations
return likelihood(avgb)
end
Can that be done?