Notation and Conventions

Consistent notation is half the battle when moving from scalar conjugate models in Part I to matrix-variate hierarchical and latent-variable models in Parts II and III. This reference collects Hoff’s conventions and highlights the exact translation to Python (numpy / scipy.stats) and R.

0.2Core Symbols

Table 2: Core mathematical notation used throughout this companion, following Hoff (2009).
SymbolMeaning
𝒴,  Θ\mathcal{Y},\; \ThetaSample space of possible datasets and parameter space of possible parameter values.
Y,  yY,\; yUppercase denotes an unknown random variable (before observation); lowercase denotes its realized numerical value.
Y~,  y~\tilde{Y},\; \tilde{y}A future (unobserved) observation drawn from the same population, governed by the predictive distribution p(y~∣y)p(\tilde{y} \mid y).
p(⋅),  p(⋅∣⋅)p(\cdot),\; p(\cdot \mid \cdot)Generic density or mass function, distinguished by its arguments (e.g., p(θ)p(\theta) is the prior, p(y∣θ)p(y \mid \theta) the sampling model, p(θ∣y)p(\theta \mid y) the posterior).
∝\proptoProportional to, as a function of the variable of interest (multiplicative constants independent of that variable are absorbed).
𝐲,  𝐗\mathbf{y},\; \mathbf{X}Column vector 𝐲=(y1,…,yn)T\mathbf{y} = (y_1, \dots, y_n)^T and n×pn \times p design matrix 𝐗\mathbf{X} with ii-th row 𝐱iT\mathbf{x}_i^T.
y¯,  s2\bar{y},\; s^2Sample mean y¯=1n∑i=1nyi\bar{y} = \frac{1}{n}\sum_{i=1}^n y_i and unbiased sample variance s2=1n−1∑i=1n(yi−y¯)2s^2 = \frac{1}{n-1}\sum_{i=1}^n (y_i - \bar{y})^2.
θ,  ϕ\theta,\; \phiPrimary parameter of interest (often a mean or rate) and generic full parameter vector (e.g., ϕ=(θ,σ2)\phi = (\theta, \sigma^2)) or natural parameter in an exponential family.
σ~2=1/σ2,  τ~2=1/τ2\tilde{\sigma}^2 = 1/\sigma^2,\; \tilde{\tau}^2 = 1/\tau^2Precision (inverse variance); in normal models, precisions add directly. (Context always distinguishes precision tildes from predictive Y~\tilde{Y}, non-centered latent variables θ~j\tilde{\theta}_j, and dummy integration variables θ~\tilde{\theta}.)
tr⁡(A),  ∣A∣,  etr⁡(A)\operatorname{tr}(A),\; \lvert A \rvert,\; \operatorname{etr}(A)Matrix trace ∑jAj,j\sum_j A_{j,j}, determinant det⁡(A)\det(A), and exponential trace exp⁡(tr⁡(A))\exp(\operatorname{tr}(A)).
Φ(⋅),  Φ−1(⋅)\Phi(\cdot),\; \Phi^{-1}(\cdot)Standard normal CDF and its inverse (quantile function).
ϕ(s),  S,  Seff\phi^{(s)},\; S,\; S_{\text{eff}}State at iteration ss of a Monte Carlo or MCMC sampler, total number of draws, and effective sample size.
z−j,  Σb,az_{-j},\; \Sigma_{b,a}All elements of zz except index jj; submatrix of Σ\Sigma with rows indexed by bb and columns by aa.

0.3Parameterization Traps Across Hoff, R, and Python

Three parameterization conventions cause the vast majority of bugs when implementing Hoff’s formulas in code. Keep them in mind whenever you translate an equation into numpy or scipy.stats:For complete density formulas, moments, and conjugate tables, see Appendix A.

  1. Normal distribution — variance vs. standard deviation. Hoff writes normal⁡(θ,σ2)\operatorname{normal}(\theta, \sigma^2) with the variance σ2\sigma^2 as the second argument, whereas both R (dnorm, rnorm) and Python (np.random.normal, scipy.stats.norm) expect the standard deviation σ=σ2\sigma = \sqrt{\sigma^2}.
  2. Gamma and Inverse-Gamma — rate vs. scale. Hoff writes gamma⁡(a,b)\operatorname{gamma}(a, b) with shape aa and rate bb, so E[X]=a/bE[X] = a/b and p(x)∝xa−1e−bxp(x) \propto x^{a-1} e^{-bx}. R’s dgamma(x, a, b) also uses rate bb by default, whereas numpy.random.Generator.gamma(shape=a, scale=1/b) and scipy.stats.gamma(a=a, scale=1/b) expect the scale 1/b1/b. For σ2∼inverse-gamma⁡(a,b)\sigma^2 \sim \operatorname{inverse-gamma}(a, b), draw precision σ~2∼gamma⁡(a,b)\tilde{\sigma}^2 \sim \operatorname{gamma}(a, b) (using scale=1/b) and take σ2=1/σ~2\sigma^2 = 1/\tilde{\sigma}^2.
  3. Inverse-Wishart — Hoff’s S0−1S_0^{-1} convention. Hoff writes Σ∼inverse-Wishart⁡(ν0,S0−1)\Sigma \sim \operatorname{inverse-Wishart}(\nu_0, S_0^{-1}) to mean Σ−1∼Wishart⁡(ν0,S0−1)\Sigma^{-1} \sim \operatorname{Wishart}(\nu_0, S_0^{-1}), so E[Σ−1]=ν0S0−1E[\Sigma^{-1}] = \nu_0 S_0^{-1} and E[Σ]=1ν0−p−1S0E[\Sigma] = \frac{1}{\nu_0 - p - 1} S_0. In scipy.stats.invwishart(df=nu0, scale=S0), the scale parameter is S0S_0 directly (not S0−1S_0^{-1}).