Unable to parameterize lag parameter

You don’t want to do that. That will fix lag to a random value instead of sampling it.

There’s no workaround if you have a parameter that gets discretized, it will no longer be differentiable wrt to the distribution that uses that parameter.

You can cast the uniform value to an integer with max_lag = max_lag.astype("int") but it may still not be able to sample the discrete variable at all.

A better option if you still want to only use NUTS may be to marginalize your discrete variable with something like MarginalModel — pymc_experimental 0.0.15 documentation

In general though it may be quite hard to infer the lag parameters at all from your data. Commonly it’s just fixed to a constant