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:
mutensor_like of float

Real-valued mean vector

W(M, M) tensor_like of int

Symmetric adjacency matrix of 1s and 0s indicating adjacency between elements. If possible, W is converted to a sparse matrix, falling back to a dense variable. as_sparse_or_tensor_variable() is used for this sparse or tensorvariable conversion.

alphatensor_like of float

Autoregression parameter taking values greater than -1 and less than 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).

tautensor_like of float

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

References

Methods

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

Creates a tensor variable corresponding to the cls distribution.