{'fraction_non_alphanumeric': 0.02645761881430671, 'fraction_numerical': 0.0019598236158745713, 'mean_word_length': 5.1878787878787875, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A general method for Bayesian time series modelling

I introduce a general, Bayesian method for modelling univariate time series data assumed to be drawn from a continuous, stochastic process. The method accommodates arbitrary temporal sampling, and takes into account measurement uncertainties for arbitrary error models (not just Gaussian) on both the time and signal variables. Any model for the deterministic component of the variation of the signal with time is supported, as is any model of the stochastic component on the signal and time variables. Models illustrated here are constant, linear, sigmoidal, sinusoidal and quasi-sinusoidal models for the signal mean (and combinations thereof) combined with a Gaussian stochastic component, as well as purely stochastic models, the Wiener process and Ornstein–Uhlenbeck process. The posterior probability distribution over model parameters is determined via MCMC (Metropolis, parallel tempering or emcee). Models can be compared using the evidence or the “cross-validation likelihood”, in which the posterior-averaged likelihood for different partitions of the data are summed. In principle this is more robust to changes in the prior than is the evidence (the prior-averaged likelihood). Much of the description of the mathematical method in this technical note is taken from the journal article (Bailer-Jones 2012), but is repeated here so that this technical note can stand alone. The journal article describes the application to a simulated data set and to brown dwarf light curves, which is not covered here. Conversely, this technical note describes the various time series models as well as subsequent developments such as additional models and MCMC methods. This note also describes the implementation of the method into software using R, some of its internal workings, and how to use it. The code, ctsmod, is designed for use under Linux (including Mac OS X), but not Windows (as it relies on forking for parallel processing). The software is available from the above web site.