pymc.CAR#

class pymc.CAR(name, *args, rng=None, dims=None, initval=None, observed=None, total_size=None, transform=UNSET, **kwargs)[source]#

Likelihood for a conditional autoregression. This is a special case of the multivariate normal with an adjacency-structured covariance matrix.

\[f(x \mid W, \alpha, \tau) = \frac{|T|^{1/2}}{(2\pi)^{k/2}} \exp\left\{ -\frac{1}{2} (x-\mu)^{\prime} T^{-1} (x-\mu) \right\}\]

where \(T = (\tau D(I-\alpha W))^{-1}\) and \(D = diag(\sum_i W_{ij})\).

Support

\(x \in \mathbb{R}^k\)

Mean

\(\mu \in \mathbb{R}^k\)

Variance

\((\tau D(I-\alpha W))^{-1}\)

Parameters
mu: array

Real-valued mean vector

W: Numpy matrix

Symmetric adjacency matrix of 1s and 0s indicating adjacency between elements.

alpha: float or array

Autoregression parameter taking values between -1 and 1. Values closer to 0 indicate weaker correlation and values closer to 1 indicate higher autocorrelation. For most use cases, the support of alpha should be restricted to (0, 1)

tau: float or array

Positive precision variable controlling the scale of the underlying normal variates.

sparse: bool, default=False

Determines whether or not sparse computations are used

References

Methods

CAR.__init__(*args, **kwargs)

CAR.dist(mu, W, alpha, tau, *args, **kwargs)

Creates a tensor variable corresponding to the cls distribution.

CAR.logp(mu, W, alpha, tau)

Calculate log-probability of a CAR-distributed vector at specified value.

CAR.moment(size, mu, W, alpha, tau)

Attributes

rv_class

rv_op