
Estimate noise dispersion from temporal differences
Source:R/temporal_dispersion.R
temporal_dispersion.RdEstimate a pooled marginal noise scale in ordered response channels, allowing for an optional lag-one covariance approximation and a slowly changing mean.
Usage
temporal_dispersion(
y,
family = stats::quasipoisson("identity"),
order = c(2L, 4L, 8L),
mu = NULL,
weights = NULL,
rows = NULL,
minimum_mean = 20,
method = c("robust", "moment"),
correlation = c("independent", "lag1"),
ncores = NULL
)Arguments
- y
Finite ordered observations-by-channels matrix.
- family
Scalar GLM family, or one family per channel, supplying the variance function without its dispersion multiplier.
- order
Positive difference orders below `nrow(y)`, default `c(2,4,8)`.
- mu
Optional independent or smooth pilot means. With `NULL`, Poisson uses raw observations as a linear variance proxy; nonlinear variance functions use a local smooth pilot.
- weights
Positive observation precisions, scalar, row vector or matrix. Zero or nonfinite weights exclude difference stencils.
- rows
Optional logical eligibility mask, in the same formats as weights.
- minimum_mean
Minimum local mean used for relative variance estimates. Gaussian channels use every otherwise eligible stencil.
- method
`"robust"` uses squared median absolute differences calibrated to Gaussian noise; `"moment"` uses second moments.
- correlation
`"independent"` or `"lag1"`. The latter needs at least two difference orders.
- ncores
OpenMP workers; `NULL` uses physical cores.
Value
A list with per-order channel and pooled estimates, summaries `channel` and `pooled`, estimation method and covariance model.
Details
With \(a_k=(-1)^k{r\choose k}\), independent locally stationary noise has \(\operatorname{Var}(\Delta^rY_i)=\phi\sum_k a_k^2V(\mu_{i+k})\). Weighted stencil variances replace \(V(\mu)\) by \(V(\mu)/w\). The native kernel collects valid, locally variance-normalized differences. For locally constant variance and lag-one covariance \(c_1\), $$\frac{\operatorname{Var}(\Delta^rY)}{\sum_k a_k^2} =c_0-\frac{2r}{r+1}c_1.$$ A nonnegative two-endpoint spectral parameterization fits this relationship across orders. The returned `dispersion` is marginal \(c_0\), `lag1` is \(c_1\), and `long_run` is \(c_0+2c_1\). Slowly changing signals are suppressed by high-order differences. Quieter rows or a supplied pilot can reduce contamination from peaks. More extensive serial dependence requires a richer covariance model.