Timeseries

AR1(name, *args, **kwargs)

Autoregressive process with 1 lag.

AR(name, *args, **kwargs)

Autoregressive process with p lags.

GaussianRandomWalk(name, *args, **kwargs)

Random Walk with Normal innovations

GARCH11(name, *args, **kwargs)

GARCH(1,1) with Normal innovations.

EulerMaruyama(name, *args, **kwargs)

Stochastic differential equation discretized with the Euler-Maruyama method.

MvGaussianRandomWalk(name, *args, **kwargs)

Multivariate Random Walk with Normal innovations

MvStudentTRandomWalk(name, *args, **kwargs)

Multivariate Random Walk with StudentT innovations

class pymc3.distributions.timeseries.AR(name, *args, **kwargs)

Autoregressive process with p lags.

\[x_t = \rho_0 + \rho_1 x_{t-1} + \ldots + \rho_p x_{t-p} + \epsilon_t, \epsilon_t \sim N(0,\sigma^2)\]

The innovation can be parameterized either in terms of precision or standard deviation. The link between the two parametrizations is given by

\[\tau = \dfrac{1}{\sigma^2}\]
Parameters
rho: tensor

Tensor of autoregressive coefficients. The first dimension is the p lag.

sigma: float

Standard deviation of innovation (sigma > 0). (only required if tau is not specified)

tau: float

Precision of innovation (tau > 0). (only required if sigma is not specified)

constant: bool (optional, default = False)

Whether to include a constant.

init: distribution

distribution for initial values (Defaults to Flat())

logp(value)

Calculate log-probability of AR distribution at specified value.

Parameters
value: numeric

Value for which log-probability is calculated.

Returns
TensorVariable
class pymc3.distributions.timeseries.AR1(name, *args, **kwargs)

Autoregressive process with 1 lag.

Parameters
k: tensor

effect of lagged value on current value

tau_e: tensor

precision for innovations

logp(x)

Calculate log-probability of AR1 distribution at specified value.

Parameters
x: numeric

Value for which log-probability is calculated.

Returns
TensorVariable
class pymc3.distributions.timeseries.EulerMaruyama(name, *args, **kwargs)

Stochastic differential equation discretized with the Euler-Maruyama method.

Parameters
dt: float

time step of discretization

sde_fn: callable

function returning the drift and diffusion coefficients of SDE

sde_pars: tuple

parameters of the SDE, passed as *args to sde_fn

logp(x)

Calculate log-probability of EulerMaruyama distribution at specified value.

Parameters
x: numeric

Value for which log-probability is calculated.

Returns
TensorVariable
class pymc3.distributions.timeseries.GARCH11(name, *args, **kwargs)

GARCH(1,1) with Normal innovations. The model is specified by

\[y_t = \sigma_t * z_t\]
\[\sigma_t^2 = \omega + \alpha_1 * y_{t-1}^2 + \beta_1 * \sigma_{t-1}^2\]

with z_t iid and Normal with mean zero and unit standard deviation.

Parameters
omega: tensor

omega > 0, mean variance

alpha_1: tensor

alpha_1 >= 0, autoregressive term coefficient

beta_1: tensor

beta_1 >= 0, alpha_1 + beta_1 < 1, moving average term coefficient

initial_vol: tensor

initial_vol >= 0, initial volatility, sigma_0

logp(x)

Calculate log-probability of GARCH(1, 1) distribution at specified value.

Parameters
x: numeric

Value for which log-probability is calculated.

Returns
TensorVariable
class pymc3.distributions.timeseries.GaussianRandomWalk(name, *args, **kwargs)

Random Walk with Normal innovations

Note that this is mainly a user-friendly wrapper to enable an easier specification of GRW. You are not restricted to use only Normal innovations but can use any distribution: just use theano.tensor.cumsum() to create the random walk behavior.

Parameters
mu: tensor

innovation drift, defaults to 0.0 For vector valued mu, first dimension must match shape of the random walk, and the first element will be discarded (since there is no innovation in the first timestep)

sigma: tensor

sigma > 0, innovation standard deviation (only required if tau is not specified) For vector valued sigma, first dimension must match shape of the random walk, and the first element will be discarded (since there is no innovation in the first timestep)

tau: tensor

tau > 0, innovation precision (only required if sigma is not specified) For vector valued tau, first dimension must match shape of the random walk, and the first element will be discarded (since there is no innovation in the first timestep)

init: distribution

distribution for initial value (Defaults to Flat())

logp(x)

Calculate log-probability of Gaussian Random Walk distribution at specified value.

Parameters
x: numeric

Value for which log-probability is calculated.

Returns
TensorVariable
random(point=None, size=None)

Draw random values from GaussianRandomWalk.

Parameters
point: dict, optional

Dict of variable values on which random values are to be conditioned (uses default point if not specified).

size: int, optional

Desired size of random sample (returns one sample if not specified).

Returns
array
class pymc3.distributions.timeseries.MvGaussianRandomWalk(name, *args, **kwargs)

Multivariate Random Walk with Normal innovations

Parameters
mu: tensor

innovation drift, defaults to 0.0

cov: tensor

pos def matrix, innovation covariance matrix

tau: tensor

pos def matrix, inverse covariance matrix

chol: tensor

Cholesky decomposition of covariance matrix

init: distribution

distribution for initial value (Defaults to Flat())

Notes

Only one of cov, tau or chol is required.

logp(x)

Calculate log-probability of Multivariate Gaussian Random Walk distribution at specified value.

Parameters
x: numeric

Value for which log-probability is calculated.

Returns
TensorVariable
random(point=None, size=None)

Draw random values from MvGaussianRandomWalk.

Parameters
point: dict, optional

Dict of variable values on which random values are to be conditioned (uses default point if not specified).

size: int or tuple of ints, optional

Desired size of random sample (returns one sample if not specified).

Returns
array
Examples
class pymc3.distributions.timeseries.MvStudentTRandomWalk(name, *args, **kwargs)

Multivariate Random Walk with StudentT innovations

Parameters
nu: degrees of freedom
mu: tensor

innovation drift, defaults to 0.0

cov: tensor

pos def matrix, innovation covariance matrix

tau: tensor

pos def matrix, inverse covariance matrix

chol: tensor

Cholesky decomposition of covariance matrix

init: distribution

distribution for initial value (Defaults to Flat())