Abstract
Time series often reflect variation associated with other related variables. Controlling for the effect of these variables is useful when modeling or analysing the time series. We introduce a novel approach to normalize time series data conditional on a set of covariates. We do this by modeling the conditional mean and the conditional variance of the time series with generalized additive models using a set of covariates. The conditional mean and variance are then used to normalize the time series. We illustrate the use of conditionally normalized series using two applications involving river network data. First, we show how these normalized time series can be used to impute missing values in the data. Second, we show how the normalized series can be used to estimate the conditional autocorrelation function and conditional cross-correlation functions via additive models. Finally we use the conditional cross-correlations to estimate the time it takes water to flow between two locations in a river network.
Introduction
In real-world applications, time series data are rarely stationary. Statistical properties such as mean and variance often fluctuate due to external drivers. For instance, stream temperature is not merely a function of time but is heavily influenced by air temperature, elevation, and precipitation. Standard normalization techniques, such as z-score scaling, assume constant mean ($\mu$) and standard deviation ($\sigma$), which fails to account for these external dependencies. This paper proposes a "conditional normalization" technique to remove this conditional variation, allowing for more effective analysis of the underlying signal.
Methodology: Conditional Normalization
The proposed method utilizes a "dynamic z-score" approach where the mean and variance are modeled as functions of covariates. This is achieved through a three-step process using Generalized Additive Models (GAMs):
- Modeling the Conditional Mean: A GAM estimates the mean of the time series as a function of covariates (e.g., air temperature). GAMs are preferred for their ability to handle non-linear relationships via smooth splines.
- Modeling the Conditional Variance: The squared residuals from the mean model are used to fit a second GAM (typically with a Gamma distribution) to estimate how variance changes with the same covariates.
- Normalization: The original series is transformed into a "conditionally normalized" series by subtracting the estimated mean and dividing by the estimated standard deviation.
The resulting "cleaned" series represents the internal dynamics of the system, making it suitable for tasks like missing value imputation via ARIMA models or estimating conditional correlation functions.
Applications and Results
The method was validated using two environmental datasets: the NorWeST Stream Temperature dataset and high-frequency water quality data from NEON Pringle Creek.
In the NorWeST study, the model successfully captured seasonal nuances, revealing that the standard deviation of stream temperature in summer was three times higher than in winter. This high-fidelity modeling led to an imputation accuracy where the 95% "highest density interval" contained the true value 94.6% of the time.
In the Pringle Creek application, the method was used to estimate dynamic "lag times"—the time water takes to travel between sensors. Unlike traditional methods that provide a single average, conditional cross-correlation showed that lag time decreases as water levels increase, providing a data-driven alternative to physical tracer experiments.
Conclusion and Future Work
Conditional normalization treats preprocessing as a sophisticated modeling task, effectively stripping away external noise to reveal core system dynamics. While highly effective, future work could address limitations such as the occasional generation of negative values for strictly positive variables (e.g., turbidity) by employing bounded distributions. Additionally, extending the framework to multivariate Vector Autoregressions (VAR) and explicitly modeling spatial dependencies in sensor networks are promising directions for further research.
Reproducibility Note: The authors have released the conduits R package and made their code available on GitHub.
Summary updated