Time series regression models for DLNMs. Use when fitting GLMs with quasi-Poisson, controlling confounders, or specifying temperature/pollution-mortality models.
The standard DLNM time series model for daily health counts:
model <- glm(death ~ cb + ns(date, df = 7*nyears) + dow + ns(temp, df = 3),
family = quasipoisson(), data = df)
cb: Cross-basis matrix (from crossbasis()).ns(date, df): Natural cubic spline of time for long-term trend + seasonality.dow: Day of week (factor).| Outcome Type | Family | When |
|---|
| Daily death/admission counts | quasipoisson() | Default — handles over-dispersion |
| Counts (strict Poisson) | poisson() | Only if dispersion ≈ 1 |
| Counts (high over-dispersion) | MASS::glm.nb() | Negative binomial alternative |
summary(model)$dispersion. If >> 1, use quasipoisson().offset(log(population)) for rate models.ns(date, df = 7 * nyears): 7 df/year is a common starting point. Captures seasonal + long-term trends.ns(year, df) + ns(doy, df).ns(temp, df = 3-6) depending on role.ns(humidity, df = 3) as additional confounder.factor(dow) — always include.acf(residuals(model, type = "deviance")) — should show no pattern.model$deviance / model$df.residual ≈ 1 is ideal.summary(model)$dispersion.dow: Day-of-week effects are strong in mortality data.