particles.distributions.MvNormal¶
- class MvNormal(loc=0.0, scale=1.0, cov=None)[source]¶
Multivariate Normal distribution.
- Parameters:
loc (ndarray) – location parameter (default: 0.)
scale (ndarray) – scale parameter (default: 1.)
cov ((d, d) ndarray) – covariance matrix (default: identity, with dim determined by loc)
Notes
The dimension d is determined either by argument
cov(if it is a dxd array), or by argument loc (ifcovis not specified). In the latter case, the covariance matrix is set to the identity matrix.If
scaleis set to1.(default value), we use the standard parametrisation of a Gaussian, with meanlocand covariance matrixcov. Otherwise:x = dists.MvNormal(loc=m, scale=s, cov=Sigma).rvs(size=30)
is equivalent to:
x = m + s * dists.MvNormal(cov=Sigma).rvs(size=30)
The idea is that they are cases when we may want to pass varying means and scales (but a fixed correlation matrix). Note that
covdoes not need to be a correlation matrix; e.g.:MvNormal(loc=m, scale=s, cov=C)
corresponds to N(m, diag(s)*C*diag(s)).
In addition, note that m and s may be (N, d) vectors; i.e for each n=1…N we have a different mean, and a different scale.
To specify a Multivariate Normal distribution with a different covariance matrix for each particle, see
VaryingCovNormal.Methods
__init__([loc, scale, cov])linear_transform(z)logpdf(x)pdf(x)posterior(x[, Sigma])Posterior for model: X1, ..., Xn ~ N(theta, Sigma), theta ~ self.
ppf(u)Note: if dim(u) < self.dim, the remaining columns are filled with 0.
rvs([size])shape(size)Attributes
dimint([x]) -> integer int(x, base=10) -> integer