> For the complete documentation index, see [llms.txt](https://zavalab.gitbook.io/statschemebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zavalab.gitbook.io/statschemebook/nomenclature.md).

# Nomenclature: math and Python

The Python code uses the same symbols as the slides wherever Python allows it. This page lists the general rules, how `scipy.stats` parameters map to the slides' notation, and (below) the symbol table of every notebook in the book.

## General conventions

| Slides                                                                                  | Python                                                          | Notes                                                             |
| --------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ----------------------------------------------------------------- |
| random variable $$X$$, realizations $$x\_\omega$$                                       | `x_omega`                                                       | array of observations; `x` is a grid where a pdf/cdf is evaluated |
| observation index $$\omega$$, sample set $$\mathcal{S}$$, size $$S$$                    | `omega` (or loop index `w`), `S`                                | —                                                                 |
| pdf $$f(x)$$, cdf $$F(x)$$, threshold $$t$$                                             | `f`, `F`, `t`                                                   | —                                                                 |
| empirical estimates $$\hat{f}$$, $$\hat{F}$$, $$\hat{\mathbb{E}}\_X$$, $$\hat{\theta}$$ | `f_hat`, `F_hat`, `E_hat`, `theta_hat`                          | a hat becomes the suffix `_hat`                                   |
| $$\mathbb{E}\_X$$, $$\mathbb{V}\_X$$, $$\mathbb{SD}\_X$$                                | `E_X`, `V_X`, `SD_X`                                            | —                                                                 |
| quantile $$\mathbb{Q}\_X(\alpha)$$                                                      | `Q`, or `X.ppf(alpha)`                                          | —                                                                 |
| Greek letters $$\mu,\sigma,\alpha,\beta,\xi,\theta,\kappa,\gamma$$                      | `mu`, `sigma`, `alpha`, `beta`, `xi`, `theta`, `kappa`, `gamma` | —                                                                 |
| $$\lambda$$                                                                             | `lam`                                                           | `lambda` is a reserved word in Python                             |
| subscripts $$\theta\_0$$, $$X\_1$$, $$\Sigma\_{12}$$                                    | `theta[0]`, `X1` / `x1`, `Sigma[0, 1]`                          | Python indexes from 0                                             |
| conditional quantities $$\mu\_{1\mid 2}$$, $$\Sigma\_{2\mid 1}$$, $$f(x\_1\mid x\_2)$$  | `mu_1g2`, `Sigma_2g1`, `f_1g2`                                  | `g` reads "given"                                                 |
| vectors and matrices $$\mathbf{y}$$, $$\mathbf{X}$$, $$\mathbf{W}$$                     | `y`, `X`, `W`                                                   | —                                                                 |
| $$\mathrm{Cov}\[X]$$, $$\mathrm{PCorr}\[X]$$                                            | `Cov`, `PCorr` (`Cov_hat`, ...)                                 | sample covariance uses $$1/S$$ as on the slides                   |
| decision $$u$$, decision set $$\mathcal{U}$$, optimum $$u^\*$$                          | `u`, `U`, `u_star`                                              | —                                                                 |
| risk measure $$\rho(Y(u))$$                                                             | `rho`                                                           | —                                                                 |

## `scipy.stats` parameters in the slides' notation

| Slides                                                           | `scipy.stats`                                                   |
| ---------------------------------------------------------------- | --------------------------------------------------------------- |
| $$\mathcal{N}(\mu,\sigma^2)$$                                    | `norm(loc=mu, scale=sigma)` (standard deviation, not variance)  |
| $$\mathcal{U}\_c(a,b)$$                                          | `uniform(loc=a, scale=b - a)`                                   |
| $$\mathcal{B}(p)$$, $$\mathrm{Bi}(n,p)$$                         | `bernoulli(p)`, `binom(n, p)`                                   |
| $$\mathcal{H}(N\_y,N\_t,n,p)$$                                   | `hypergeom(M=N_t, n=N_y, N=n)`                                  |
| $$\mathcal{P}(\lambda)$$                                         | `poisson(mu=lam)`                                               |
| $$\mathrm{Exp}(\beta)$$ (intensity $$\eta=1/\beta$$)             | `expon(scale=beta)`                                             |
| $$\mathrm{Gamma}(\alpha,\beta)$$                                 | `gamma(a=alpha, scale=beta)`                                    |
| $$\chi^2(r)$$                                                    | `chi2(df=r)`                                                    |
| $$\mathrm{Weibull}(\xi,\beta)$$ (shape $$\xi$$, scale $$\beta$$) | `weibull_min(c=xi, scale=beta)`                                 |
| log-normal with $$\mu,\sigma$$                                   | `lognorm(s=sigma, scale=np.exp(mu))`                            |
| $$\mathrm{GEV}(a,b,c)$$                                          | `genextreme(c=-c, loc=a, scale=b)` (opposite sign of the shape) |
| $$\mathcal{N}(\mu,\Sigma)$$ (multivariate)                       | `multivariate_normal(mean=mu, cov=Sigma)`                       |

## Symbols used in each notebook

### Chapter 1: Introduction

#### [`ch1_mixer_example`](/statschemebook/chapter-1-introduction/01-motivation.md)

| Slides                                               | Python           | Meaning                                  |
| ---------------------------------------------------- | ---------------- | ---------------------------------------- |
| $$\omega$$                                           | `omega`          | observation (time) index                 |
| $$S$$                                                | `S`              | number of observations                   |
| $$f\_1(\omega)$$, $$f\_2(\omega)$$, $$f\_3(\omega)$$ | `f1`, `f2`, `f3` | measured flows \[gpm]                    |
| $$\epsilon(\omega)$$                                 | `epsilon`        | conservation mismatch $$f\_3-f\_1-f\_2$$ |

#### [`ch1_gibbs_data`](/statschemebook/chapter-1-introduction/01-motivation.md)

| Slides  | Python | Meaning          |
| ------- | ------ | ---------------- |
| $$P$$   | `P`    | pressure \[bar]  |
| $$T$$   | `T`    | temperature \[K] |
| $$\xi$$ | `xi`   | conversion \[-]  |

#### [`ch1_gibbs_example`](/statschemebook/chapter-1-introduction/02-random-variables.md)

| Slides                             | Python            | Meaning                                                    |
| ---------------------------------- | ----------------- | ---------------------------------------------------------- |
| $$X$$, $$x\_\omega$$               | `x_omega`         | reactor pressure (RV) and its realizations \[bar]          |
| $$Y(u)$$, $$Y(u')$$, $$y\_\omega$$ | `y_low`, `y_high` | conversion (RV) and its realizations at $$u$$, $$u'$$ \[%] |
| $$\mathcal{S}$$, $$S$$             | `S`               | set and number of observations                             |
| $$\Delta x$$                       | `dx`              | bin size of the empirical pdf                              |
| $$\hat{f}(x)$$, $$\hat{F}(x)$$     | `f_hat`, `F_hat`  | empirical pdf and cdf                                      |
| $$u$$, $$u'$$                      | `u_low`, `u_high` | operating temperature (decision) \[K]                      |

#### [`ch1_pdf_cdf_discrete`](/statschemebook/chapter-1-introduction/03-types-of-random-variables.md)

| Slides                          | Python    | Meaning                          |
| ------------------------------- | --------- | -------------------------------- |
| $$\mathcal{D}$$                 | `D`       | domain $${-1,0,1,2}$$            |
| $$f(x)$$                        | `f`       | pdf on the domain                |
| $$x\_\omega,\ \omega\in\Omega$$ | `x_omega` | the 10 realizations              |
| $$t$$, $$F(t)$$                 | `t`, `F`  | cdf evaluated on a grid of $$t$$ |

#### [`ch1_pdf_cdf_continuous`](/statschemebook/chapter-1-introduction/03-types-of-random-variables.md)

| Slides                   | Python           | Meaning                             |
| ------------------------ | ---------------- | ----------------------------------- |
| $$f(x)$$, $$F(t)$$       | `f`, `F`         | pdf and cdf                         |
| $$x\_\omega$$, $$S$$     | `x_omega`, `S`   | realizations and their number       |
| $$\Delta x$$             | `dx`             | discretization (bin) size           |
| $$\hat{f}$$, $$\hat{F}$$ | `f_hat`, `F_hat` | discrete (empirical) approximations |

#### [`ch1_mean_var_descriptors`](/statschemebook/chapter-1-introduction/04-from-data-to-models.md)

| Slides                                                                     | Python                       | Meaning                       |
| -------------------------------------------------------------------------- | ---------------------------- | ----------------------------- |
| $$x\_\omega$$, $$S$$                                                       | `x_omega`, `S`               | realizations and their number |
| $$\hat{\mathbb{E}}\_X$$, $$\hat{\mathbb{V}}\_X$$, $$\hat{\mathbb{SD}}\_X$$ | `E_hat`, `V_hat`, `SD_hat`   | empirical mean, variance, SD  |
| $$\hat{f}(x)$$, $$\hat{F}(x)$$                                             | `f_hat` (histogram), `F_hat` | empirical pdf and cdf         |

### Chapter 2: Univariate Random Variables

#### [`ch2_example_uniform`](/statschemebook/chapter-2-univariate-random-variables/02-discrete-uniform.md)

| Slides                    | Python        | Meaning                                     |
| ------------------------- | ------------- | ------------------------------------------- |
| $$X$$, $$x\_\omega$$      | `x_omega`     | weekly status: $$0$$ = fails, $$1$$ = works |
| $$S$$                     | `S`           | number of weeks observed (156)              |
| $$a$$, $$b$$, $$n$$       | `a`, `b`, `n` | uniform parameters, $$n=b-a+1$$             |
| $$\hat{\mathbb{P}}(X=x)$$ | `P_hat[x]`    | empirical pdf                               |

#### [`ch2_compare_hypergeometric`](/statschemebook/chapter-2-univariate-random-variables/04-hypergeometric.md)

| Slides                              | Python        | Meaning                                        |
| ----------------------------------- | ------------- | ---------------------------------------------- |
| $$N\_t$$, $$N\_y$$                  | `N_t`, `N_y`  | population size and number of type-$$Y$$ items |
| $$n$$                               | `n`           | sample size                                    |
| $$p=N\_y/N\_t$$                     | `p`           | fraction of type-$$Y$$ items                   |
| $$\mathcal{D}$$, $$f(x)$$, $$F(x)$$ | `D`, `f`, `F` | domain, pdf, cdf                               |

#### [`ch2_example_hypergeometric`](/statschemebook/chapter-2-univariate-random-variables/04-hypergeometric.md)

| Slides                   | Python    | Meaning                          |
| ------------------------ | --------- | -------------------------------- |
| $$N\_t$$                 | `N_t`     | weeks in the record (population) |
| $$N\_y$$                 | `N_y`     | weeks in failure mode            |
| $$p=N\_y/N\_t$$          | `p`       | fraction of failure weeks        |
| $$n$$                    | `n`       | number of inspections            |
| $$f(x)=\mathbb{P}(X=x)$$ | `f(x, n)` | hypergeometric pdf               |

#### [`ch2_example_poisson`](/statschemebook/chapter-2-univariate-random-variables/06-poisson.md)

| Slides                                     | Python             | Meaning                                    |
| ------------------------------------------ | ------------------ | ------------------------------------------ |
| $$z$$                                      | `z`                | interval length (days in a month)          |
| $$x\_{Jan},x\_{Feb},x\_{Mar}$$             | `x_omega`          | failures recorded per month                |
| $$\hat{\mathbb{E}}\_X$$, $$\hat{\lambda}$$ | `E_hat`, `lam_hat` | empirical mean and estimate of $$\lambda$$ |
| $$f(x)=\lambda^x e^{-\lambda}/x!$$         | `f(x)`             | Poisson pdf                                |

#### [`ch2_mixing_gaussians`](/statschemebook/chapter-2-univariate-random-variables/08-gaussian.md)

| Slides                              | Python            | Meaning                                            |
| ----------------------------------- | ----------------- | -------------------------------------------------- |
| $$f\_1$$                            | `f1`              | deterministic input flow (10 gpm)                  |
| $$F\_2\sim\mathcal{N}(20,1)$$       | `mu_2`, `sigma_2` | uncertain input flow                               |
| $$\kappa$$                          | `kappa`           | valve coefficient                                  |
| $$F\_3=f\_1+\kappa F\_2$$           | `mu_3`, `sigma_3` | output flow, $$\mathcal{N}(10+20\kappa,\kappa^2)$$ |
| $$z\_\alpha=\mathbb{Q}\_Z(\alpha)$$ | `z_alpha`         | standard-normal quantile                           |

#### [`ch2_example_lognormal`](/statschemebook/chapter-2-univariate-random-variables/09-log-normal.md)

| Slides                                | Python             | Meaning                              |
| ------------------------------------- | ------------------ | ------------------------------------ |
| $$\mathbb{M}\_X$$                     | `M_X`              | median particle size (200 $$\mu m$$) |
| $$\mathbb{Q}\_X(\alpha)$$, $$\alpha$$ | `Q_alpha`, `alpha` | 90% quantile (400 $$\mu m$$)         |
| $$\mu$$, $$\sigma$$                   | `mu`, `sigma`      | log-normal parameters                |
| $$F(x)$$, $$f(x)$$                    | `F`, `f`           | cdf and pdf                          |

#### [`ch2_example_chisquare`](/statschemebook/chapter-2-univariate-random-variables/12-chi-squared.md)

| Slides                                           | Python        | Meaning                          |
| ------------------------------------------------ | ------------- | -------------------------------- |
| $$F\_3\sim\mathcal{N}(\mu,\sigma^2)$$            | `mu`, `sigma` | output flow of the mixer         |
| $$\alpha$$                                       | `alpha`       | probability outside the interval |
| $$Y\sim\chi^2(1)$$, $$\mathbb{Q}\_Y(1-\alpha)$$  | `Q_Y`         | chi-squared quantile             |
| $$z\_{\alpha/2}=\sqrt{\mathbb{Q}\_Y(1-\alpha)}$$ | `z_alpha_2`   | critical value                   |

#### [`ch2_example_weibull`](/statschemebook/chapter-2-univariate-random-variables/13-weibull.md)

| Slides                                | Python        | Meaning                      |
| ------------------------------------- | ------------- | ---------------------------- |
| $$\beta$$, $$\xi$$                    | `beta`, `xi`  | scale \[m/s] and shape \[-]  |
| $$\mathbb{M}\_X$$                     | `M_X`         | median wind speed            |
| $$\mathbb{E}\_X$$, $$\mathbb{MO}\_X$$ | `E_X`, `MO_X` | mean and mode                |
| $$x\_\omega$$                         | `x_omega`     | simulated 10-min wind speeds |

### Chapter 3: Multivariate Random Variables

#### [`ch3_gibbs_conditional`](/statschemebook/chapter-3-multivariate-random-variables/02-joint-pdfs-and-cdfs.md)

| Slides                                                          | Python           | Meaning                                                |
| --------------------------------------------------------------- | ---------------- | ------------------------------------------------------ |
| $$x\_{\omega,1}$$, $$x\_{\omega,2}$$                            | `x1`, `x2`       | pressure \[bar], conversion \[-]                       |
| $$\mathcal{A}\_1$$, $$\mathcal{A}\_2$$                          | `in_A1`, `in_A2` | indicators $$\mathbf{1}\[x\_\omega\in\mathcal{A}\_i]$$ |
| $$\hat{\mathbb{P}}(X\in\mathcal{A}\_1\cap\mathcal{A}\_2)$$      | `P_A1_and_A2`    | empirical joint probability                            |
| $$\hat{\mathbb{P}}(X\in\mathcal{A}\_1\mid X\in\mathcal{A}\_2)$$ | `P_A1_given_A2`  | empirical conditional probability                      |

#### [`ch3_thermostat_lifetime`](/statschemebook/chapter-3-multivariate-random-variables/02-joint-pdfs-and-cdfs.md)

| Slides                                 | Python                     | Meaning                              |
| -------------------------------------- | -------------------------- | ------------------------------------ |
| $$\mu\_1$$, $$\mu\_2$$                 | `mu_1`, `mu_2`             | mean lifetimes \[yr]                 |
| $$f(x\_1,x\_2)$$, $$F(t\_1,t\_2)$$     | `f`, `F`                   | joint pdf and cdf                    |
| $$f\_1$$, $$f\_2$$, $$F\_1$$, $$F\_2$$ | `f_1`, `f_2`, `F_1`, `F_2` | marginal pdfs and cdfs               |
| $$f(x\_1\mid x\_2)$$                   | `f_1g2`                    | conditional pdf ("1 given 2")        |
| $$\mathbb{P}(X\in\mathcal{A})$$        | `P_A`                      | probability of event $$\mathcal{A}$$ |

#### [`ch3_flow_cytometer_discrete`](/statschemebook/chapter-3-multivariate-random-variables/02-joint-pdfs-and-cdfs.md)

| Slides                                                 | Python                   | Meaning                                       |
| ------------------------------------------------------ | ------------------------ | --------------------------------------------- |
| $$X\_1$$ (FSC), $$X\_2$$ (SSC)                         | `x1`, `x2`               | log front and side scatter of each droplet    |
| $$S$$                                                  | `S`                      | number of droplets                            |
| $$\mathcal{D}\_1=\mathcal{D}\_2={L,M,H}$$              | `edges_1`, `edges_2`     | bin edges of the three categories             |
| $$\hat{f}(x\_1,x\_2)$$                                 | `f_hat`                  | empirical joint pdf (rows: SSC, columns: FSC) |
| $$\hat{f}\_1$$, $$\hat{f}\_2$$                         | `f1_hat`, `f2_hat`       | empirical marginal pdfs                       |
| $$\hat{f}(x\_1\mid x\_2)$$, $$\hat{f}(x\_2\mid x\_1)$$ | `f_hat_1g2`, `f_hat_2g1` | empirical conditional pdfs                    |

#### [`ch3_flow_cytometer_empirical`](/statschemebook/chapter-3-multivariate-random-variables/02-joint-pdfs-and-cdfs.md)

| Slides                                           | Python          | Meaning                                     |
| ------------------------------------------------ | --------------- | ------------------------------------------- |
| $$x\_{\omega,1}$$ (FSC), $$x\_{\omega,2}$$ (SSC) | `x1`, `x2`      | realizations                                |
| $$\hat{\mathcal{D}}$$                            | `x1.min()`, ... | empirical domain (bounding box of the data) |
| $$\Delta x\_1=\Delta x\_2$$                      | `dx`            | bin size (0.05)                             |
| $$\hat{f}(x\_1,x\_2)$$                           | `f_hat`         | empirical joint pdf                         |

#### [`ch3_gibbs_covariance`](/statschemebook/chapter-3-multivariate-random-variables/07-summarizing-statistics.md)

| Slides                                                          | Python                 | Meaning                                                     |
| --------------------------------------------------------------- | ---------------------- | ----------------------------------------------------------- |
| $$x\_\omega\in\mathbb{R}^5$$, $$S$$                             | `x_omega` (S x 5), `S` | pressure, conversion, outflows of CO, H$$\_2$$, CH$$\_3$$OH |
| $$\hat{m}\_i=\hat{\mathbb{E}}\[X\_i]$$                          | `m_hat`                | empirical means                                             |
| $$\hat{\mathrm{Cov}}\[X]$$                                      | `Cov_hat`              | sample covariance (with $$1/S$$)                            |
| $$\hat{\mathrm{PCorr}}\[X]=D^{-1}\hat{\mathrm{Cov}}\[X]D^{-1}$$ | `PCorr_hat`, `D`       | Pearson correlation                                         |

#### [`ch3_gaussian_geometry`](/statschemebook/chapter-3-multivariate-random-variables/08-multivariate-gaussian.md)

| Slides                                    | Python        | Meaning                                                                            |
| ----------------------------------------- | ------------- | ---------------------------------------------------------------------------------- |
| $$\mu$$, $$\Sigma$$                       | `mu`, `Sigma` | mean and covariance                                                                |
| $$1-\alpha$$                              | `1 - alpha`   | probability of the region (95%)                                                    |
| $$\mathbb{Q}(1-\alpha)$$ of $$\chi^2(n)$$ | `Q_n`         | quantile defining the ellipse $$\mathcal{E}$$ and its bounding box $$\mathcal{B}$$ |
| $$\mathbb{Q}(1-\alpha)$$ of $$\chi^2(1)$$ | `Q_1`         | quantile defining the marginal box                                                 |

### Chapter 4: Estimation for Random Variables

#### [`ch4_gaussian_moments_example`](/statschemebook/chapter-4-estimation-for-random-variables/02-method-of-moments.md)

| Slides                                                                    | Python                | Meaning                   |
| ------------------------------------------------------------------------- | --------------------- | ------------------------- |
| $$x\_\omega$$, $$S$$                                                      | `x_omega`, `S`        | data and sample size      |
| $$\hat{\mathbb{E}}\_X$$, $$\hat{\mathbb{V}}\_X$$                          | `E_hat`, `V_hat`      | sample mean and variance  |
| $$\hat{\mu}=\hat{\mathbb{E}}\_X$$, $$\hat{\sigma}^2=\hat{\mathbb{V}}\_X$$ | `mu_hat`, `sigma_hat` | moment-matching estimates |

#### [`ch4_leastsquares_example`](/statschemebook/chapter-4-estimation-for-random-variables/03-least-squares-method.md)

| Slides                 | Python               | Meaning                            |
| ---------------------- | -------------------- | ---------------------------------- |
| $$x\_\omega$$, $$S$$   | `x_omega`, `S`       | data and sample size               |
| $$t\_k$$, $$N$$        | `t`, `N`             | cdf thresholds                     |
| $$\hat{F}\_k$$         | `F_hat`              | empirical cdf at $$t\_k$$          |
| $$\theta=(\xi,\beta)$$ | `theta = (xi, beta)` | Weibull shape and scale            |
| $$F\_X(t\mid\theta)$$  | `F_model(t, theta)`  | model cdf $$1-e^{-(t/\beta)^\xi}$$ |

#### [`ch4_example_mle_exp`](/statschemebook/chapter-4-estimation-for-random-variables/04-maximum-likelihood-estimation.md)

| Slides                                                              | Python         | Meaning                        |
| ------------------------------------------------------------------- | -------------- | ------------------------------ |
| $$x\_\omega$$, $$S$$                                                | `x_omega`, `S` | data and sample size           |
| $$\beta$$                                                           | `beta`         | grid of candidate scale values |
| $$\log L(\beta)=-S\log\beta-\frac{1}{\beta}\sum\_\omega x\_\omega$$ | `logL`         | log likelihood                 |
| $$\hat{\beta}=\hat{\mathbb{E}}\_X$$                                 | `beta_hat`     | MLE                            |

#### [`ch4_montecarlo_approx`](/statschemebook/chapter-4-estimation-for-random-variables/06-monte-carlo-approximations.md)

| Slides                                                                   | Python               | Meaning                                                     |
| ------------------------------------------------------------------------ | -------------------- | ----------------------------------------------------------- |
| $$S$$                                                                    | `S_values`           | sample sizes                                                |
| $$\hat{\mathbb{E}}^S\_{\phi(X)}=\frac{1}{S}\sum\_\omega\phi(x\_\omega)$$ | `E_hat`, `E_log_hat` | MC estimates of $$\mathbb{E}\[X]$$, $$\mathbb{E}\[\log X]$$ |
| $$\hat{\mathbb{V}}^S$$                                                   | `V_hat`              | MC estimate of $$\mathbb{V}\[e^{-X}+X^2]$$                  |
| $$\hat{\mathbb{P}}(X\in\mathcal{A})$$                                    | `P_hat`              | MC estimate of $$\mathbb{P}(X\leq 1)$$                      |

#### [`ch4_clt_example`](/statschemebook/chapter-4-estimation-for-random-variables/07-central-limit-theorem.md)

| Slides                                       | Python                | Meaning                              |
| -------------------------------------------- | --------------------- | ------------------------------------ |
| $$S$$                                        | `S`                   | sample size of each average          |
| $$\bar{X}=\hat{\mathbb{E}}^S\_X$$            | `x_bar`               | sample averages (one per repetition) |
| $$e=\mathbb{E}\[X]$$, $$v^2=\mathbb{V}\[X]$$ | `e`, `v2`             | true mean and variance               |
| $$\mathcal{N}(e, v^2/S)$$                    | `norm(e, sqrt(v2/S))` | CLT limit                            |

#### [`ch4_evt_example`](/statschemebook/chapter-4-estimation-for-random-variables/08-extreme-value-theorem.md)

| Slides                               | Python        | Meaning                            |
| ------------------------------------ | ------------- | ---------------------------------- |
| $$X\sim\mathcal{N}(2,1)$$            | `mu`, `sigma` | underlying RV                      |
| $$X^S\_{max}=\max{X\_1,\dots,X\_S}$$ | `x_max`       | sample maxima (one per repetition) |
| $$\mathrm{GEV}(a,b,c)$$              | `a`, `b`, `c` | location, scale, shape             |

### Chapter 5: Estimation for Structural Models

#### [`ch5_linear_est_example`](/statschemebook/chapter-5-estimation-for-structural-models/02-scalar-linear-models.md)

| Slides                                                                     | Python                    | Meaning                                       |
| -------------------------------------------------------------------------- | ------------------------- | --------------------------------------------- |
| $$(x\_\omega,y\_\omega)$$, $$S$$                                           | `x_omega`, `y_omega`, `S` | observation pairs                             |
| $$\theta$$, $$\sigma$$                                                     | `theta`, `sigma`          | true slope and noise SD ($$\sigma^2=0.0625$$) |
| $$\hat{\theta}=\sum\_\omega x\_\omega y\_\omega/\sum\_\omega x\_\omega^2$$ | `theta_hat`               | MLE (least squares)                           |
| $$\hat{y}*\omega=\hat{\theta}x*\omega$$, $$\hat{\epsilon}\_\omega$$        | `y_hat`, `eps_hat`        | predictions and residuals                     |
| $$SSE(\theta)$$                                                            | `SSE`                     | sum of squared errors                         |

#### [`ch5_heat_capacity_lin_est`](/statschemebook/chapter-5-estimation-for-structural-models/03-multidimensional-linear-models.md)

| Slides                                                   | Python                      | Meaning                                     |
| -------------------------------------------------------- | --------------------------- | ------------------------------------------- |
| $$X$$ (temperature), $$Y$$ (heat capacity)               | `x`, `y`                    | inputs \[K] and outputs \[cal/mol-K]        |
| $$\mathbf{X}=\[1,\ x,\ x^2]$$, $$\mathbf{y}$$            | `X`, `y`                    | data matrix and output vector               |
| $$\theta=(\theta\_0,\theta\_1,\theta\_2)$$               | `theta` (true), `theta_hat` | parameters                                  |
| $$\hat{\mathbf{y}}$$, $$\hat{\epsilon}$$                 | `y_hat`, `eps_hat`          | predictions and residuals                   |
| $$\hat{\sigma}$$                                         | `sigma_hat`                 | estimated noise SD                          |
| $$\mathrm{Cov}\[\hat{\theta}]$$, $$\mathcal{I}(\theta)$$ | `Cov_theta`, `FI`           | parameter covariance and Fisher information |

#### [`ch5_heat_capacity_uncertainty`](/statschemebook/chapter-5-estimation-for-structural-models/05-uncertainty-quantification.md)

| Slides                                                                                | Python                   | Meaning                                                      |
| ------------------------------------------------------------------------------------- | ------------------------ | ------------------------------------------------------------ |
| $$\hat{\theta}$$, $$\mathrm{Cov}\[\hat{\theta}]$$                                     | `theta_hat`, `Cov_theta` | estimate and its covariance                                  |
| $$q\_{n+1}$$                                                                          | `q_np1`                  | 0.95 quantile of $$\chi^2(n+1)$$                             |
| $$m\_i=\sqrt{q\_{n+1}\mathrm{Cov}\[\hat{\theta}]\_{ii}}$$                             | `m_theta`                | parameter CI half-widths                                     |
| $$\mathrm{Cov}\[\hat{\mathbf{y}}]=\mathbf{X}\mathrm{Cov}\[\hat{\theta}]\mathbf{X}^T$$ | `Cov_y`                  | prediction covariance                                        |
| $$q\_S$$, $$m\_\omega$$                                                               | `q_S`, `m_y`             | 0.95 quantile of $$\chi^2(S)$$ and prediction CI half-widths |

#### [`ch5_hougen_watson`](/statschemebook/chapter-5-estimation-for-structural-models/07-estimation-for-general-nonlinear-models.md)

| Slides                                                                                | Python                          | Meaning                                  |
| ------------------------------------------------------------------------------------- | ------------------------------- | ---------------------------------------- |
| $$x\_{1,\omega},x\_{2,\omega},x\_{3,\omega}$$                                         | `X[:, 0]`, `X[:, 1]`, `X[:, 2]` | partial pressures ($$S=13$$ experiments) |
| $$y\_\omega$$                                                                         | `y`                             | reaction rate                            |
| $$\theta=(\theta\_0,\dots,\theta\_4)$$                                                | `theta[0]`, ..., `theta[4]`     | parameters                               |
| $$m(\theta)$$, $$SSE(\theta)=\frac{1}{2}\lVert\mathbf{y}-\mathbf{m}(\theta)\rVert^2$$ | `m(theta, X)`, `SSE(theta)`     | model and objective                      |

#### [`ch5_hougen_watson_constraints`](/statschemebook/chapter-5-estimation-for-structural-models/08-prior-knowledge.md)

| Slides                                                                                 | Python                 | Meaning                                    |
| -------------------------------------------------------------------------------------- | ---------------------- | ------------------------------------------ |
| $$\underline{\theta}$$, $$\overline{\theta}$$                                          | `theta_lb`, `theta_ub` | bounds $$(0,\dots,0)$$ and $$(2,\dots,2)$$ |
| $$\nabla\_\theta\mathbf{m}(\hat{\theta})$$                                             | `J`                    | Jacobian returned by the solver            |
| $$\mathcal{H}(\hat{\theta})\approx\nabla\_\theta\mathbf{m}^T\nabla\_\theta\mathbf{m}$$ | `H`                    | Gauss-Newton Hessian                       |
| $$\lambda$$                                                                            | `lam`                  | eigenvalues of $$\mathcal{H}$$             |
| $$\mathrm{Cov}\[\hat{\theta}]$$, $$\mathbb{V}\[\hat{\theta}]$$                         | `Cov_theta`, `V_theta` | covariance and variances                   |

#### [`ch5_bayes_estimation`](/statschemebook/chapter-5-estimation-for-structural-models/09-bayesian-estimation.md)

| Slides                                                                | Python                                          | Meaning                                                     |
| --------------------------------------------------------------------- | ----------------------------------------------- | ----------------------------------------------------------- |
| $$\theta\sim\mathcal{N}(\bar{\theta},\Sigma\_\theta)$$                | `theta_bar`, `Sigma_theta`                      | prior (0, 1)                                                |
| $$y\sim\mathcal{N}(\theta x,\sigma^2)$$                               | `sigma2`                                        | likelihood noise variance (1)                               |
| $$\log f(\theta)$$, $$\log f(y\mid\theta)$$, $$\log f(\theta\mid y)$$ | `log_f_theta`, `log_f_y_theta`, `log_f_theta_y` | log prior, log likelihood, log posterior (up to a constant) |

### Chapter 6: Statistical Data Analysis and Learning — Part I: Dimensionality Reduction

#### [`ch6_gibbs_pca`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-statistical-data-analysis-and-learning/02-principal-component-analysis.md)

| Slides                                         | Python     | Meaning                                                     |
| ---------------------------------------------- | ---------- | ----------------------------------------------------------- |
| $$\mathbf{X}$$ ($$S\times n$$)                 | `X`        | data matrix with columns $$(T, P, C)$$, centered and scaled |
| $$\boldsymbol{\Sigma}=\mathbf{X}^T\mathbf{X}$$ | `Sigma`    | kernel matrix                                               |
| $$\mathbf{W}$$, $$\lambda\_k$$                 | `W`, `lam` | eigenvectors and eigenvalues (descending)                   |
| $$\alpha\_k$$                                  | `alpha`    | spectrum (% of information)                                 |
| $$\mathbf{T}=\mathbf{X}\mathbf{W}$$            | `T_pc`     | principal components (scores)                               |

#### [`ch6_gibbs_pca_estimation`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-statistical-data-analysis-and-learning/03-principal-component-estimation.md)

| Slides                                                       | Python                       | Meaning                                                                  |
| ------------------------------------------------------------ | ---------------------------- | ------------------------------------------------------------------------ |
| $$\mathbf{X}=\[1, X\_1,\dots,X\_5]$$                         | `X`                          | intercept, $$P$$, $$CO$$, $$H\_2$$, $$CH\_3OH$$ flows, $$T$$ ($$S=250$$) |
| $$\mathbf{y}$$                                               | `y`                          | conversion                                                               |
| $$\hat{\theta}$$, $$\mathrm{Cov}(\hat{\theta})$$             | `theta_hat`, `Cov_theta`     | standard estimate                                                        |
| $$\mathbf{W}\_1$$, $$\boldsymbol{\Lambda}\_1$$, $$n\_1$$     | `W1`, `Lam1`, `n1`           | retained eigenvectors/eigenvalues                                        |
| $$\mathbf{T}\_1=\mathbf{X}\mathbf{W}\_1$$                    | `T1`                         | reduced inputs                                                           |
| $$\hat{\gamma}$$, $$\hat{\theta}=\mathbf{W}\_1\hat{\gamma}$$ | `gamma_hat`, `theta_hat_pca` | PCA estimate                                                             |

#### [`ch6_gibbs_pca_estimation_sparse`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-statistical-data-analysis-and-learning/04-sparse-pca.md)

| Slides                 | Python     | Meaning                                                                   |
| ---------------------- | ---------- | ------------------------------------------------------------------------- |
| $$\mathbf{W}$$         | `W`        | eigenvectors of $$\mathbf{X}^T\mathbf{X}$$ (rows: 1, $$X\_1,\dots,X\_5$$) |
| $$\tilde{\mathbf{W}}$$ | `W_sparse` | sparse eigenvectors with one nonzero entry each                           |

#### [`ch6_gibbs_pca_estimation_svd`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-statistical-data-analysis-and-learning/05-singular-value-decomposition.md)

| Slides                                              | Python                  | Meaning                                                              |
| --------------------------------------------------- | ----------------------- | -------------------------------------------------------------------- |
| $$\mathbf{X}=\mathbf{U}\mathbf{S}\mathbf{V}^T$$     | `U`, `s`, `Vt`          | SVD (`s` holds the singular values $$s\_j$$; `S` is the sample size) |
| $$\lambda\_i=s\_i^2$$                               | `lam`                   | eigenvalues of $$\mathbf{X}^T\mathbf{X}$$                            |
| $$\mathrm{rank}(\mathbf{X}\lbrack :,1..k\rbrack )$$ | `np.linalg.matrix_rank` | rank as columns are added                                            |

### Chapter 6: Statistical Data Analysis and Learning — Part II: Signal Processing

#### [`ch6_example_convolutions`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-signal-processing/02-1d-convolution-operations.md)

| Slides                                        | Python                | Meaning                                          |
| --------------------------------------------- | --------------------- | ------------------------------------------------ |
| $$f\_j$$                                      | `f`                   | signal                                           |
| $$g\_j$$                                      | `g`                   | filter (weights over a window of $$N$$ entries)  |
| $$\varphi=f\*g$$                              | `phi`                 | convolution $$\varphi\_k=\sum\_j g\_j f\_{k+j}$$ |
| $$N$$, $$\alpha$$, $$\sigma=(N-1)/(2\alpha)$$ | `N`, `alpha`, `sigma` | window length, width factor, Gaussian SD         |

#### [`ch6_fourier_transform`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-signal-processing/03-1d-fourier-transforms.md)

| Slides                                                  | Python                    | Meaning                             |
| ------------------------------------------------------- | ------------------------- | ----------------------------------- |
| $$f(t)=\sin(2\pi\omega\_1t)+\sin(2\pi\omega\_2t)$$      | `f`, `omega_1`, `omega_2` | signal (30 and 60 Hz)               |
| $$\hat{f}\_k=\sum\_j f\_je^{-i2\pi kj/N}$$              | `f_hat = np.fft.fft(f)`   | discrete FT                         |
| $$\omega\_k$$, $$\lvert\hat{f}\_k\rvert$$               | `omega`, `power(f_hat)`   | frequencies and one-sided magnitude |
| $$\mathcal{F}{f\*g}=\mathcal{F}{f}\cdot\mathcal{F}{g}$$ | `phi_hat = f_hat * g_hat` | convolution theorem                 |

#### [`ch6_image_filters_2D`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-signal-processing/06-2d-fourier-transforms.md)

| Slides                                           | Python             | Meaning                                   |
| ------------------------------------------------ | ------------------ | ----------------------------------------- |
| $$f$$, $$\hat{f}=\mathcal{F}{f}$$                | `f`, `f_hat`       | image and its 2D FT                       |
| $$g\_1$$, $$g\_2$$ ($$\sigma=1$$, $$\sigma=10$$) | `g1`, `g2`         | Gaussian filters (same size as the image) |
| $$\hat{f}\_i=\hat{f}\cdot\hat{g}\_i$$            | `f1_hat`, `f2_hat` | filtered images in the frequency domain   |
| $$f\_i=\mathcal{F}^{-1}{\hat{f}\_i}$$            | `f1`, `f2`         | filtered images                           |

### Chapter 6: Statistical Data Analysis and Learning — Part III: Machine Learning Models

#### [`ch6_gibbs_logistic`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-classification-models.md)

| Slides                                       | Python                 | Meaning                                                 |
| -------------------------------------------- | ---------------------- | ------------------------------------------------------- |
| $$x\_\omega=(P\_\omega,C\_\omega)$$          | `X` (columns `P`, `C`) | features: pressure and conversion                       |
| $$y\_\omega\in{0,1}$$                        | `y`                    | label: 1 = normal (low $$T$$), 0 = failure (high $$T$$) |
| $$\theta$$, $$\theta^Tx$$                    | `theta`, `evidence`    | parameters and evidence                                 |
| $$m(x,\theta)=\mathbb{P}(Y=1\mid x,\theta)$$ | `m_hat`                | classification probability                              |
| $$\hat{y}\_\omega$$                          | `y_hat`                | predicted label                                         |

#### [`ch6_hougen_watson_kernel`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-classification-models/02-kernel-models.md)

| Slides                                                                           | Python               | Meaning                              |
| -------------------------------------------------------------------------------- | -------------------- | ------------------------------------ |
| $$x\_\omega$$, $$y\_\omega$$                                                     | `X`, `y`             | partial pressures and reaction rates |
| $$k(x\_\omega,x\_{\omega'})=\exp(-\gamma\lVert x\_\omega-x\_{\omega'}\rVert^2)$$ | `rbf(xi, xj, gamma)` | RBF kernel                           |
| $$\mathbf{K}$$, $$\lambda$$                                                      | `K`, `lam`           | kernel matrix and regularization     |
| $$\hat{\mathbf{y}}=\mathbf{K}(\mathbf{K}+\lambda I)^{-1}\mathbf{y}$$             | `y_hat`              | kernel prediction                    |

#### [`ch6_gibbs_kriging`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-classification-models/03-kriging.md)

| Slides                                             | Python                 | Meaning                                             |
| -------------------------------------------------- | ---------------------- | --------------------------------------------------- |
| $$X=(P,T)$$, $$Y=C$$                               | `X`, `y`               | inputs (pressure, temperature) and conversion       |
| $$k(x,x',\gamma)$$, $$\hat{\gamma}$$, $$\sigma^2$$ | `kernel`, `gp.kernel_` | Matern kernel plus noise term, and their MLE values |
| $$m(x)$$, $$\sigma(x)$$                            | `m_x`, `sigma_x`       | predictive mean and SD                              |
| $$\epsilon\_\omega$$                               | `eps_gp`, `eps_lin`    | residuals of kriging and linear models              |

#### [`ch6_neuralnet_basis`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-classification-models/04-neural-nets.md)

| Slides                                                        | Python                          | Meaning                                 |
| ------------------------------------------------------------- | ------------------------------- | --------------------------------------- |
| $$a\_j=\theta^I\_{j,1}x+\theta^I\_{j,0}$$                     | `theta_I1[j] * x + theta_I0[j]` | evidence of perceptron $$j$$            |
| $$h\_j(a)=1/(1+e^{-a\_j})$$                                   | `h(a)`                          | sigmoidal activation (basis function)   |
| $$\hat{y}=\sum\_j\theta^O\_jh(a\_j)$$                         | `m(theta, x)`                   | NN output                               |
| $$\theta=(\theta^I\_{\cdot,1},\theta^O,\theta^I\_{\cdot,0})$$ | `theta`                         | the 18 parameters ($$N=6$$ perceptrons) |
| $$\mathcal{H}\approx\mathcal{J}^T\mathcal{J}$$                | `H`                             | Gauss-Newton Hessian                    |

#### [`ch6_cnn_endotoxins_caseI`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-classification-models/05-convolutional-neural-nets.md)

| Slides                                                                     | Python                         | Meaning                                                  |
| -------------------------------------------------------------------------- | ------------------------------ | -------------------------------------------------------- |
| $$\mathbf{X}\_\omega$$                                                     | `X[w, 0]`                      | $$50\times 50$$ grayscale scatter field                  |
| $$y\_\omega$$                                                              | `y`                            | class: `bipolar` (no endotoxin) or `radial` (endotoxin)  |
| $$\Theta^I$$, $$\theta^I$$                                                 | `cnn[0].weight`, `cnn[0].bias` | $$3\times 3$$ filter and bias of the convolutional layer |
| $$\mathbf{A}=\mathbf{X}\*\Theta^I+\theta^I$$, $$\mathbf{Z}=h(\mathbf{A})$$ | `cnn[0]`, `cnn[1]`             | evidence and ReLU activation                             |
| $$NN(\mathbf{w},\gamma)$$                                                  | `cnn[3]`                       | fully connected layer (2 classes, softmax)               |
| $$L(\beta)$$                                                               | `loss_fn`                      | cross-entropy (log) loss                                 |

#### [`ch6_cnn_endotoxins_caseII`](/statschemebook/chapter-6-statistical-data-analysis-and-learning/01-classification-models/05-convolutional-neural-nets.md)

| Slides                                                                     | Python                         | Meaning                                                           |
| -------------------------------------------------------------------------- | ------------------------------ | ----------------------------------------------------------------- |
| $$\mathbf{X}\_\omega$$                                                     | `X[w, 0]`                      | $$50\times 50$$ grayscale scatter field                           |
| $$y\_\omega$$                                                              | `y`                            | class: EC, PA, or SM (*E. coli*, *P. aeruginosa*, *S. minnesota*) |
| $$\Theta^I\_j$$, $$\theta^I\_j$$                                           | `cnn[0].weight`, `cnn[0].bias` | two $$3\times 3$$ filters and biases                              |
| $$\mathbf{A}=\mathbf{X}\*\Theta^I+\theta^I$$, $$\mathbf{Z}=h(\mathbf{A})$$ | `cnn[0]`, `cnn[1]`             | evidence and ReLU activation                                      |
| $$NN(\mathbf{w},\gamma)$$                                                  | `cnn[3]`                       | fully connected layer (3 classes, softmax)                        |
| $$L(\beta)$$                                                               | `loss_fn`                      | cross-entropy (log) loss                                          |

### Chapter 7: Decision-Making Under Uncertainty

#### [`ch7_generator_det`](/statschemebook/chapter-7-decision-making-under-uncertainty/02-deterministic-decision-making.md)

| Slides                                | Python       | Meaning                                        |
| ------------------------------------- | ------------ | ---------------------------------------------- |
| $$L$$, realizations                   | `L_omega`    | random power load (Weibull, scale 10, shape 2) |
| $$u$$, $$\mathcal{U}={0,1,\dots,10}$$ | `u`, `U`     | generator capacity and options                 |
| $$R=\max(L-u,0)$$                     | `R`          | residual demand bought from the grid           |
| $$Y(u)=\alpha\_R R^2+\alpha\_u u^2$$  | `cost(u, L)` | total cost ($$\alpha\_R=5$$, $$\alpha\_u=15$$) |
| $$r=\max\_\omega r\_\omega$$          | `L_peak`     | representative (peak) load                     |
| $$u\_D^\*$$                           | `u_D`        | deterministic decision                         |

#### [`ch7_npv_comparison`](/statschemebook/chapter-7-decision-making-under-uncertainty/03-attitudes-towards-risk.md)

| Slides                                                                | Python            | Meaning                                |
| --------------------------------------------------------------------- | ----------------- | -------------------------------------- |
| $$c\_I$$, $$c\_{II}$$                                                 | `c_I`, `c_II`     | capital \[thousand USD] (25 and 50)    |
| $$R\_I\sim\mathcal{N}(0.5,0.1)$$, $$R\_{II}\sim\mathcal{N}(0.4,0.2)$$ | `R_I`, `R_II`     | annual rate of return (mean, SD)       |
| $$i$$                                                                 | `i`               | interest rate (5%, 10 years)           |
| $$NPV$$, i.e. $$Y(u)$$ and $$Y(u')$$                                  | `NPV_I`, `NPV_II` | net present value (negative = revenue) |

#### [`ch7_generator_twostage`](/statschemebook/chapter-7-decision-making-under-uncertainty/09-formulations-with-recourse.md)

| Slides                                    | Python     | Meaning                                   |
| ----------------------------------------- | ---------- | ----------------------------------------- |
| $$X=(X\_1,X\_2)$$                         | `X1`, `X2` | two random loads ($$S=200$$ samples)      |
| $$u\in\mathcal{U}={1,10}$$                | `u`, `U`   | capacity (first stage, preemptive)        |
| $$W(X)\in\mathcal{W}(u)$$                 | `W`        | generator output (second stage, recourse) |
| $$R=X\_1+X\_2-W(X)$$                      | `R`        | residual load                             |
| $$Y(u,W(X))=\alpha\_R R^2+\alpha\_u u^2$$ | `cost`     | cost                                      |

#### [`ch7_bayesopt_yield`](/statschemebook/chapter-7-decision-making-under-uncertainty/11-bayesian-optimization.md)

| Slides                                           | Python                           | Meaning                                         |
| ------------------------------------------------ | -------------------------------- | ----------------------------------------------- |
| $$u=(u\_1,u\_2,u\_3)\in\[-1,1]^3$$               | `u`                              | scaled temperature, time, acid concentration    |
| $$\varphi(u)$$                                   | `phi(u)`                         | yield (a quadratic model plays the "black box") |
| $$\mathcal{D}\_\ell$$                            | `data_u`, `data_y`               | experiments so far                              |
| $$m\_\ell(u)$$, $$\sigma\_\ell(u)$$              | `gp.predict(u, return_std=True)` | kriging mean and SD                             |
| $$AF\_\ell(u)=m\_\ell(u)+\kappa\sigma\_\ell(u)$$ | `AF(u)`, `kappa`                 | acquisition function ($$\kappa=0.2$$)           |
