Not evaluating prior for a specific RV during NUTS within a compound model?

Hello pymc3 community,

I have a (conceptual) question, on whether it is possible to have NUTS ignore logPs for some RVs.
I am doing compound sampling for a model with about 6 RVs, of which two are sampled with my own Gibbs steps, and the remaining variables are sampled using NUTS.

As the parameters for the prior on the two Gibbs variables would need to be recalculated every step (Cholesky decomposition matrix of size 300x300 or larger), which is very costly. My naïve approach was to use a “static” prior with some dummy values for the RVs sampled with my Gibbs sampler, but this would lead to ‘Bad Initial energies’ during the NUTS steps every now and then.

The workaround I came up with was to just put a Uniform prior (from 0 to 1e10) on the RVs that are sampled with my Gibbs step and now my sampler is recovering parameters as it should.

Now my questions are:

  • Is this allowed or does that affect the NUTS in any negative way? My gut feeling tells me that it should be fine as the Uniform Prior just adds a constant offset to logP during every step?

  • Is there a better way of doing this? E.g. can I write any prior for a RV and then just somehow tell NUTS to ignore the logP for that RV?

Thanks, Stephan