Documentation

A.5 The distributions the program uses

Distributions and where each one appears

What you will learn

  • Recall the density, mean and variance of each distribution used by the estimation, simulation, design and exposure–response commands.
  • Convert between a log-normal's parameters, its CV and its geometric CV.
  • Use the χ², t, non-central χ², Poisson, negative binomial and binomial facts that the tests and intervals rest on, and read a Wilson interval.

Prerequisites: A.1.

The normal family

Univariate. \(x\sim N(\mu,\sigma^2)\) has density \(\dfrac{1}{\sqrt{2\pi\sigma^2}}e^{-(x-\mu)^2/(2\sigma^2)}\). The standard normal has distribution function \(\Phi\); \(\Phi^{-1}(0.975)=1.959964\).

Multivariate. \(x\sim N_p(\mu,S)\) with \(S\) positive definite has density

\[ \frac{1}{(2\pi)^{p/2}\lvert S\rvert^{1/2}}\exp\Bigl[-\tfrac12(x-\mu)^{\mathsf T}S^{-1}(x-\mu)\Bigr]. \]

Taking \(-2\log\) of this density gives \(p\log2\pi+\log\lvert S\rvert+(x-\mu)^{\mathsf T}S^{-1}(x-\mu)\): the form of every objective function in the book, with the constant \(p\log 2\pi\) kept or dropped by convention (page A.6). The quadratic form \((x-\mu)^{\mathsf T}S^{-1}(x-\mu)\) is the squared Mahalanobis distance, and for \(N_p\) data it follows a \(\chi^2_p\).

Linear transformations. If \(x\sim N(\mu,S)\) then \(Ax+b\sim N(A\mu+b,\ ASA^{\mathsf T})\). This is the rule behind the delta method (page A.12) and behind drawing with a Cholesky factor (page A.4).

The log-normal

If \(\log P\sim N(m,s^2)\), then \(P=e^{m+s\,z}\) and

Property Value
median, geometric mean \(e^{m}\)
mean \(e^{m+s^2/2}\)
CV \(\sqrt{e^{s^2}-1}\)
geometric CV (the program's "geometric CV %") \(100\sqrt{e^{s^2_{\log x}}-1}\ \%\)

The usual parameterisation \(P_i=\theta e^{\eta_i}\) with \(\eta_i\sim N(0,\omega^2)\) therefore has median \(\theta\) and mean \(\theta e^{\omega^2/2}\): the typical value \(\theta\) is the median of the population, not the mean.

Chi-square, t and F

Distribution Definition Mean Variance Where it appears
\(\chi^2_k\) sum of \(k\) squared standard normals \(k\) \(2k\) likelihood-ratio tests, Wald tests, goodness-of-fit
\(t_\nu\) \(z/\sqrt{w/\nu}\), \(w\sim\chi^2_\nu\) 0 (\(\nu>1\)) \(\nu/(\nu-2)\) (\(\nu>2\)) confidence intervals with estimated SD
multivariate \(t_\nu\) \(\mu+L z/\sqrt{w/\nu}\) \(\mu\) (\(\nu>1\)) \(\tfrac{\nu}{\nu-2}LL^{\mathsf T}\) the importance-sampling proposal, with \(\nu=4\) (page A.11)
\(F_{d_1,d_2}\) ratio of two scaled \(\chi^2\) \(d_2/(d_2-2)\) the F test of an exposure effect (page A.17)

Critical values used throughout:

df \(\chi^2_{0.95}\) \(\chi^2_{0.99}\)
1 3.841 6.635
2 5.991 9.210
3 7.815 11.345
4 9.488 13.277
5 11.070 15.086

So \(\Delta\mathrm{OFV}>3.84\) with one degree of freedom is \(p<0.05\); \(>6.63\) is \(p<0.01\); \(>10.83\) is \(p<0.001\). For \(t_\nu\) at the 97.5th percentile: 2.571 (\(\nu=5\)), 2.228 (10), 2.042 (30), 1.984 (100), tending to 1.960.

The non-central chi-square

If \(z_1,\dots,z_k\) are independent \(N(\mu_l,1)\), then \(\sum z_l^2\sim\chi'^2_k(\lambda)\) with non-centrality \(\lambda=\sum\mu_l^2\). Its mean is \(k+\lambda\). It is a Poisson mixture of central \(\chi^2\) distributions:

\[ P\bigl(\chi'^2_k(\lambda)>c\bigr)=\sum_{m\ge0}e^{-\lambda/2}\frac{(\lambda/2)^m}{m!}\,P\bigl(\chi^2_{k+2m}>c\bigr), \]

the series that the power command sums (page A.16). A Wald test statistic \(\bigl(\hat\beta/\mathrm{SE}\bigr)^2\) has this distribution with \(k=1\) and \(\lambda=\beta^2/\operatorname{Var}(\hat\beta)\), which is why power depends on the effect only through \(\lambda\).

Discrete distributions

Distribution Mass function Mean, variance Used for
Binomial\((n,p)\) \(\binom nk p^k(1-p)^{n-k}\) \(np,\ np(1-p)\) a proportion of responders; the number of significant replicates
Poisson\((\mu)\) \(e^{-\mu}\mu^y/y!\) \(\mu,\ \mu\) counts with an exposure time
Negative binomial NB2\((\mu,\kappa)\) \(\dfrac{\Gamma(y+\kappa)}{\Gamma(\kappa)\,y!}\Bigl(\dfrac{\kappa}{\kappa+\mu}\Bigr)^{\kappa}\Bigl(\dfrac{\mu}{\kappa+\mu}\Bigr)^{y}\) \(\mu,\ \mu+\mu^2/\kappa\) over-dispersed counts; \(\kappa=e^{\tau}\) is estimated on the log scale

For the Poisson, mean equals variance; the dispersion \(\hat\phi=\dfrac{1}{n-k_p}\sum_i(y_i-\hat\mu_i)^2/\hat\mu_i\) is near 1 when that holds, and a value above about 1.5 says the variance is larger than the Poisson model allows.

Intervals for a proportion

For \(k\) events in \(n\) trials, with \(\hat p=k/n\) and \(z=1.959964\):

\[ \text{Wald: }\ \hat p\pm z\sqrt{\hat p(1-\hat p)/n},\qquad \text{Wilson: }\ \frac{\hat p+\frac{z^2}{2n}\pm z\sqrt{\frac{\hat p(1-\hat p)}{n}+\frac{z^2}{4n^2}}}{1+z^2/n}. \]

The Wilson interval is the one nlmx uses (clamped to \([0,1]\)); the Wald interval can leave \([0,1]\) and has poor coverage near 0 and 1 and for small \(n\).

Worked illustration. 78 significant replicates out of 100: \(\hat p=0.78\), Monte Carlo SE \(\sqrt{0.78\times0.22/100}=0.0414\). The Wald interval is \((0.699,\ 0.861)\) and the Wilson interval \((0.689,\ 0.850)\): shifted toward \(0.5\), as expected. For 8 of 10 the Wilson interval is \((0.490,\ 0.943)\), honest about how little ten replicates say.

Common mistakes

  • Reporting the mean of a log-normal when the model's \(\theta\) is its median.
  • Using \(z=1.96\) for a small sample where a \(t\) quantile is right (the exposure–response commands use \(t\) for least-squares intervals and \(z\) for maximum-likelihood ones; page A.17).
  • Calling a Poisson analysis adequate when the dispersion is well above 1.

Review checklist

  • Can you convert \(\omega^2\) to a CV and to a median-to-mean ratio?
  • Do you know which test statistic follows which distribution, and with how many degrees of freedom?
  • Can you say why the Wilson interval is preferred to the Wald interval for a proportion?

See the previous page, the next page and the mathematical reference.