I believe this is not what I meant. Maybe some more context would help:
I am conducting a series of Bernoulli experiments where the probability of success is dependent on time (i*tau here) like so:
p_i = sin(period * tau * i + phase)^2
The period and the phase (phi) are not directly observed, only the result of multiple successive experiments (data in the code). We want to model perturbations to the initial phase with a random walk.