Is f(a,b) a CDF? (as a PDF it doesn’t necessarily need to be in [0,1])?
Why is b not defined outside loop, as it doesn’t depend on observations?
I think @dlakelan solution might work, just adding:
@addlogprob!(log(f(observation[i]; a=a, b=b))
instead of using observations[i].
Does this sound resonable?