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).
| Symbol | Meaning |
|---|---|
| Sample space of possible datasets and parameter space of possible parameter values. | |
| Uppercase denotes an unknown random variable (before observation); lowercase denotes its realized numerical value. | |
| A future (unobserved) observation drawn from the same population, governed by the predictive distribution . | |
| Generic density or mass function, distinguished by its arguments (e.g., is the prior, the sampling model, the posterior). | |
| Proportional to, as a function of the variable of interest (multiplicative constants independent of that variable are absorbed). | |
| Column vector and design matrix with -th row . | |
| Sample mean and unbiased sample variance . | |
| Primary parameter of interest (often a mean or rate) and generic full parameter vector (e.g., ) or natural parameter in an exponential family. | |
| Precision (inverse variance); in normal models, precisions add directly. (Context always distinguishes precision tildes from predictive , non-centered latent variables , and dummy integration variables .) | |
| Matrix trace , determinant , and exponential trace . | |
| Standard normal CDF and its inverse (quantile function). | |
| State at iteration of a Monte Carlo or MCMC sampler, total number of draws, and effective sample size. | |
| All elements of except index ; submatrix of with rows indexed by and columns by . |
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.
- Normal distribution — variance vs. standard deviation. Hoff writes with the variance as the second argument, whereas both R (
dnorm,rnorm) and Python (np.random.normal,scipy.stats.norm) expect the standard deviation . - Gamma and Inverse-Gamma — rate vs. scale. Hoff writes with shape and rate , so and . R’s
dgamma(x, a, b)also uses rate by default, whereasnumpy.random.Generator.gamma(shape=a, scale=1/b)andscipy.stats.gamma(a=a, scale=1/b)expect the scale . For , draw precision (usingscale=1/b) and take . - Inverse-Wishart — Hoff’s convention. Hoff writes to mean , so and . In
scipy.stats.invwishart(df=nu0, scale=S0), thescaleparameter is directly (not ).