PyMC Compilation Nesting with pytensor.scan

The recursion relationship is in your scan function, not in the synthetic data you generated. At each step, coef_mode[i] = acc[i-1] + coef_prior[i-1] * task_array[i-1] is the output of the previous step, and coef_mu is a function of coef_mode.