Combined trace plot

Hi there,

That’s a question I’ve been meaning to ask for a long time, when I do a traceplot with az, how is the combined trace is calculated?

For instance in the illustration here, the chains clearly don’t give the same result, but what bothers me is that the maximum of the combined trace is neither the mean or the median of the combined traces (e.g., concatenated).



For non combined trace plots, the draws from each chain are used to generate the respective KDE independently. For combined ones, the draws from all chains are flattened and used all at once to generate a single KDE.

I am not sure what you mean by either of that, mean, median nor concatenated, sorry, maybe you could try to illustrate what you expected even if with a hand drawn picture?

Dear Oriol,

I haven’t followed up on that, sorry. I didn’t realize the combined plot showed a KDE, it’s much clearer now, thanks. Let me ask you another question though, which is still related I think:

It happens often that the individual SMC chains seem to probe only a very limited part of the parameter space (see attached). I tried to increase the acceptance rate in order to increase the number of IMH steps, and tried to increase the threshold as well, but I keep having more or less the same result (in the sense that several chains span a narrow range and barely overlap or sometimes not even). Do you think it’s because I may have too few samples and that even though samples may update through IMH they don’t stray too much far from each other?

Another question is about the way SMC chains work together. I understand that each chain samples first from the prior, but I think I also read that SMC is pure parallel, which means they are not independent right? In a case like the plot attached, is there value in using the different distributions of the chains together, in the sense that once combined they do correspond more or less to the global expected distribution?


Hi @vian, I don’t know much about SMC and even less about the PyMC implementation. I think it would be best to create a new topic and tag it with smc tag to increase the probabilities that the relevant people see and can answer the post. Also, if the previous comment answered the question about how traceplot works, it would be great for people finding the thread in the future if you can mark it as solved