# 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

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.

alpha

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

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

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_op