Let’s try to abstract this a bit. here’s pseudocode:
- loop over x
- collect all the y’s that have that x
- collect all the z’s that have one of those y’s
- compare the y,z values to predicted y,z values for that given x.
- repeat until all x exhausted
if that’s what you’re up to, then you’re on good footing I think.
What you want is something with the flavor
@addlogprob(logpdf(MvNormal(predictions,covariances),observedvals)
because as you say, if you put your “collected” observedvals on the left side it will treat it like a parameter.
I think so long as you are looping over all your data, and just looking at it in irregular “slices” at a time, you will have a valid model, it’s just a computational problem that needs fixing as above with @addlogprob!