Time Series Contributions Welcome?

I’m doing some Bayesian Structural Time Series modelling in pymc, and as a part of that I’ll probably be extending / rewriting some of the time series distributions (for example, AR1 currently has no random() method).

For the most part I’ll be treating all the time series distributions as distributions over variable length sequences, since that makes them easier to reason about.

My current API for AR1.random is (please excuse the google style docstrings):

class AR1(distribution.Continuous):
    ...
    def random(self, length, size):
        """Generates draws of sequences from the distribution.

        Achieves this by drawing sequences of gaussian noise using the sd
        of the distribution, and taking the discounted cumulative sum of
        the noise over the length of the sequence.

        Args:
            length (int): The length of sequences to draw.
            shape (int or list of ints): The sample shape to draw.

        Returns:
            numpy.ndarray: An array of dimensions shape * length.
        """

I’d be interested in hearing what everyone’s preferences are, and in general what the expected methods are when contributing a distribution.

That’s great @cshenton! We have some plans to extend and refine time-series distribution (see github issus).

You should have a look at the random method in pm.disribution for some example. In general we import random method from scipy.stats to generate samples:

In case there is no correspondent scipy object, we implement a random method (usually hidden using _random):

PR welcome!