3. Exploratory analysis and visualization for equipment time series

Before any model is fitted, an equipment time series must be interrogated for four structural properties: trend, seasonality, autocorrelation, and operational state segmentation. These four properties determine which modeling family is defensible and which is not. A vibration RMS channel with a strong linear trend and weak autocorrelation behaves very differently from a bearing temperature channel with a diurnal cycle and long memory. Exploratory analysis is the step where that distinction is established with evidence rather than assumption.

Trend: Separating Slow Drift from Noise

Trend is the low-frequency, non-repeating component of a signal. In equipment operations it usually reflects degradation (bearing wear, fouling, catalyst deactivation), setpoint changes, or ambient drift. The practical question is not "is there a trend?" but "is the trend larger than the noise band, and is it monotonic?"

A robust first pass is a rolling median with a wide window, compared against the raw signal. For a 1 Hz vibration RMS channel sampled over 30 days, a 6-hour rolling median (21,600 samples) suppresses transient spikes while preserving degradation slope. If the rolling median at day 30 exceeds the day-1 value by more than three times the within-window interquartile range, the trend is operationally meaningful. A least-squares slope on the rolling median gives a degradation rate in engineering units per day, which is directly usable for remaining-useful-life reasoning.

Always compute trend on a channel that has been screened for sensor dropouts. A flat-lined sensor produces a perfectly linear trend of zero slope and will silently pass a naive trend test.

Seasonality: Periodicity Tied to Operating Cycles

Seasonality in industrial data is rarely calendar-based; it is cycle-based. A compressor that runs a 24-hour load-following profile produces a daily cycle. A batch reactor produces a cycle equal to batch duration. A chiller produces a cycle tied to ambient temperature. The correct period is therefore an operational parameter, not a default.

The standard diagnostic is the autocorrelation function (ACF) and its frequency-domain counterpart, the periodogram. A peak in the ACF at lag k indicates a repeating pattern every k samples. For a 1-minute-sampled channel with a 24-hour cycle, expect a peak near lag 1440. The periodogram localizes the same structure as a spectral peak at 1/1440 cycles per sample.

Once the period is identified, decompose the signal into trend, seasonal, and residual components using STL (Seasonal-Trend decomposition using Loess). STL is preferred over classical decomposition because it handles non-integer periods and is robust to outliers. The residual component is what remains for anomaly detection and modeling.

Autocorrelation: Memory and Model Selection

Autocorrelation measures how much a value depends on its own past. It is the single most important diagnostic for choosing between a regression model and a time-series model. If the ACF decays quickly (below 0.2 within a few lags), the signal is close to memoryless and standard regression with lagged features is adequate. If the ACF decays slowly and remains positive for dozens of lags, the signal has long memory and requires an explicit time-series structure such as ARIMA or a state-space model.

Two derived quantities are useful in practice. The partial autocorrelation function (PACF) isolates the direct dependence at each lag, and its first significant lag suggests the autoregressive order. The Ljung-Box test on residuals checks whether any autocorrelation remains unexplained; a p-value above 0.05 indicates the model has captured the memory structure.

from statsmodels.tsa.stattools import acf, pacf
from statsmodels.stats.diagnostic import acorr_ljungbox

acf_vals  = acf(rms_series, nlags=200, fft=True)
pacf_vals = pacf(rms_series, nlags=200, method="ywm")
lb = acorr_ljungbox(residuals, lags=[20, 50], return_df=True)
# lb["lb_pvalue"] > 0.05  ->  no significant remaining autocorrelation

Operational State Segmentation

Equipment rarely operates in a single regime. A pump may cycle through idle, ramp-up, steady load, and shutdown. Treating the full series as one distribution mixes these regimes and inflates variance, which in turn masks real anomalies. Segmentation assigns each timestamp to an operational state so that monitoring and modeling can be performed per state.

A practical segmentation pipeline uses a small set of physically meaningful features — for example, mean level, variance, and slope over a sliding window — and applies change-point detection or clustering. The output is a state label per window. The critical validation step is to check that each state corresponds to a recognizable operating condition, not merely a statistical cluster. A state that cannot be named by an operator is usually a segmentation artifact.

The table below summarizes the four properties, their primary diagnostic, and the modeling consequence.

PropertyPrimary DiagnosticModeling Consequence
TrendRolling median slope vs. noise bandDetrend or include drift term; RUL estimation
SeasonalityACF peak / periodogram peakSTL decomposition; seasonal differencing
AutocorrelationACF/PACF decay, Ljung-BoxARIMA / state-space vs. plain regression
State segmentationChange-point detection, per-state feature statsPer-state models and thresholds
Exploratory Analysis Pipeline for Equipment Time Series Raw channel: vibration RMS (1 Hz, 30 days) Trend Rolling median (6 h) Slope vs. noise band Monotonicity check → degradation rate Seasonality ACF peak at lag k Periodogram peak STL decomposition → cycle period Autocorrelation ACF / PACF decay Ljung-Box test Memory length → model family State Segmentation Sliding-window features Change-point detection Cluster → named states → per-state models Modeling Decision Detrend + seasonal differencing + ARIMA order from PACF + per-state thresholds Validation Gate Residual ACF within confidence band · each state operator-nameable · trend slope stable across windows

Putting It Together: A Reproducible Workflow

The following sequence is a defensible order of operations for a new equipment channel. It is written for a 1 Hz vibration RMS signal over 30 days, but the structure generalizes.

  1. Screen for dropouts and flat-lines. Flag any window where the standard deviation is below 1e-6 or where more than 5% of samples are missing. Exclude these windows from all downstream statistics.
  2. Compute the rolling median and slope. Use a 6-hour window. Report slope in engineering units per day. If the slope magnitude exceeds three times the within-window IQR, record a trend flag.
  3. Compute ACF and periodogram. Identify the dominant lag. Confirm it against a known operational cycle (shift length, batch duration, ambient cycle). If no operational cycle matches, treat the peak as suspect.
  4. Run STL decomposition. Extract trend, seasonal, and residual. Inspect the residual for heteroscedasticity; if variance grows with level, apply a log or Box-Cox transform before modeling.
  5. Test residual autocorrelation. Apply Ljung-Box at lags 20 and 50. If p < 0.05, the model has not captured the memory structure; increase AR or MA order.
  6. Segment operational states. Use a 10-minute sliding window with mean, variance, and slope as features. Apply change-point detection. Label each segment and verify with an operator that the labels correspond to real conditions.
A common failure mode is to skip step 1 and proceed directly to ACF. A single flat-lined sensor segment can produce a spurious ACF peak at the dropout boundary, leading to an incorrect seasonal period and a model that fits noise. Always screen first.

The deliverable of this stage is not a model. It is a short diagnostic record: trend slope and flag, dominant period and its operational justification, ACF decay length, Ljung-Box p-values, and a state label timeline. That record is what makes the subsequent modeling choices auditable and reproducible.