Interactive model — experiment with these parameters in µGauss

Scope note: This note fits a statistical model to a published series to show how a kernel represents structure. The forecast extrapolates that model. It is not a projection from the physics, ecology or economics of the series, and the series is used as published, without the corrections a domain analysis would apply.

Daily US births from 1 July 1987 to 31 December 1988, $550$ observations, are taken from the US National Center for Health Statistics series prepared for Gelman and coauthors in Bayesian Data Analysis. Because time counts days from the start of the record, the weekly cycle has an exact period of $7$. Combining a smooth term for slow baseline drift, a seven-day periodic term, and independent noise gives

$$ \begin{aligned} k(s,t) ={}& a^2 \exp\!\left(-\frac{(s-t)^2}{2\ell^2}\right) \\ &+ b^2 \exp\!\left(-\frac{2\sin^2\left(\frac{\pi\lvert s-t\rvert}{7}\right)}{\ell_p^2}\right) \\ &+ \sigma_\varepsilon^2\,\delta(s,t) , \end{aligned} $$

written RBF(l, a) + Per(p, lp, b) + WN(n) with trend degree $1$. Constraining $\ell$ to $[10, 300]$ days keeps the slow level separated from day-to-day variation, yielding a log likelihood of $-4150$ and a BIC of $8345$.

NameSymbolValueStandard error
l$\ell$$23.6$ days$5.9$
a$a$$375$$69$
lp$\ell_p$$0.94$$0.37$
b$b$$1277$$562$
n$\sigma_\varepsilon$$420$$13$

Run this in µGauss

Open µGauss with this model pre-loaded to inspect the fit, forecast, and parameter sensitivities, or adjust the kernel and refit:

Daily births over 550 days showing a sharp weekly oscillation between roughly 8000 and 12000 on a slowly shifting level, with a forecast continuing the weekly rhythm Daily births over 550 days showing a sharp weekly oscillation between roughly 8000 and 12000 on a slowly shifting level, with a forecast continuing the weekly rhythm
Daily births with a weekly periodic term. The forecast carries the seven-day pattern forward along the slow level.

Variance explained by the weekly cycle

Without the periodic term, RBF(l, a) + WN(n) attains a log likelihood of $-4685$, a BIC of $9401$, and a noise standard deviation of $1193$. Adding the fixed-period term reduces residual noise to $420$.

ModelFree parametersLog likelihoodBICNoise standard deviation
Smooth term and noise$3$$-4685$$9401$$1193$
Smooth, weekly term, and noise$5$$-4150$$8345$$420$

The weekly term drops the BIC by $1056$ and shrinks noise variance to $\left(\frac{420}{1193}\right)^2 = 0.12$ of its baseline value, eliminating 88% of residual scatter. Across 4 restarts, 3 found $-4150$ while one remained at $-4684.5$, matching the fit without periodicity.

Shape of the weekly pattern

The periodic kernel is richer than a pure sine wave. Setting $x = \frac{\pi\tau}{p}$ and $z = \frac{1}{\ell_p^2}$, applying $\sin^2 x = \frac{1 - \cos 2x}{2}$ alongside the generating series of modified Bessel functions $I_k$ expands the kernel into harmonics of period $\frac{p}{k}$:

$$ \exp\!\left(-\frac{2\sin^2 x}{\ell_p^2}\right) = e^{-z}\left(I_0(z) + 2\sum_{k \ge 1} I_k(z)\cos 2kx\right) . $$

The leading term $I_0(z)$ is a constant offset that does not vary across weekdays. At $\ell_p = 0.94$, $z = 1.12$, splitting the unit kernel variance across terms:

PartPeriod in daysShare of the variance
Constant level$\infty$$0.44$
First harmonic$7$$0.43$
Second harmonic$3.5$$0.11$
Third harmonic$2.3$$0.02$

Of the time-varying weekly signal, 76% sits in the seven-day fundamental and 20% in the three-and-a-half-day second harmonic, leaving only 4% for sharper weekday contrasts. Larger $\ell_p$ concentrates weight into the first harmonic, whereas smaller $\ell_p$ activates higher overtones.

Related notes: Quasi-periodic kernels with Gaussian and exponential envelopes, Periodic kernel with a squared exponential envelope on sunspot numbers. Kernel formulas are cataloged in the µGauss reference.