Bayesian oscillations detection in time series?

Given time series, sampled at regular intervals, I’d like to calculate a Bayes Factor comparing a model with sinusoidal oscillations (plus Normal noise) against a linear (plus Normal noise) integrating out over all parameters. I do not think this is solvable in a closed form … Has someone made a Stan model for this? Any links to Bayesian detection of periodic patterns in time series would be helpful.
The case is nicely described in this paper
Bayesian detection of periodic mRNA time profiles without use of training examples


It’s solveable. The ctsem manual describes an oscillatory model for sunspots, with system and measurement noise possible. ctsem sets up a stan model that uses a kalman filter to integrate out the states. See the ctsem github for install instructions, once loaded it will point you to the manual, or see link below. May not give exactly what you want but will point in a possible direction at least :)


This are two models I want to be able to compare


1 Like

If the system is deterministic and you have the solution then it’s pretty straightforward, can’t you just write it basically like you did, but with u(t) as the uncertainty term? Something like this?

for(t in 1:100){
  y[t] ~ normal(A0 + A1 * cos(omega*t + theta), mu)
1 Like