# Running window maximum: Any cautions?

Are there any statistical concerns with using a running-window maximum to capture peak values?

Background: We are measuring acceleration during random impacts on a structure. The impacts need ~500Hz sampling to resolve, but due to data volume I can only permanently save a 10Hz data vector. One workaround is to record a running window maximum since I am most interested in peak accelerations during impacts, and how often impacts occur. Are there any statistical concerns (bias, accuracy) about using a running-window maximum?

• Your question is unclear. What "events" are you trying to sample? How do the 1 Hz, 10 Hz, and 500 Hz rates in your question relate to one another? What statistical concerns would you expect? What subsequent processing are you performing on the data? Nov 23 '15 at 16:37
• My statistical concern is that a running window max might be a biased/inaccurate representation of peak accelerations. I am hoping others with more statistical insight can spot problems with this approach that I may have missed.
– KAE
Nov 23 '15 at 18:39
• I streamlined the question to (hopefully) make it clearer. 500Hz = sample rate necessary to fully resolve impulsive impacts. 10Hz = sample rate in the data vector that I am stuck with. 0.5Hz = candidate width of a window.
– KAE
Dec 1 '15 at 22:27

There's a few possible problems with taking a running maximum of all the accelerometer samples within your window.

• You'll miss large negative excursions. This may not be a problem; the absolute value of excursions might be enough for your application.
• You'll miss two large excursions in the one time window.
• The actual times the peaks occur at will be lost, or at least be inaccurate. For example, if adjacent windows have peaks at the beginning and then at the end, the actual time between them will be nearly two window lengths, but the reported time will be one window length
• All values will tend to be positive, which will bias the "background" acceleration.

I've written some R code to simulate discarding 49 out of every 50 values, and only keeping the maximum one in a window. The raw data are the black circles in the plot. The maximum values are the green circles; the minimum values are the red circles.

R Code Below

#27212

N <- 1000
acc <- rnorm(N)/5

Nspikes <- 10
spike_indices <- runif(Nspikes,1,N)
spike_values <- runif(Nspikes,-10,10)

acc[spike_indices] <- spike_values

decimationFactor <- 50
idx <- 1
mx <- rep(0,length(seq(1,length(acc),decimationFactor)))
mn <- rep(0,length(seq(1,length(acc),decimationFactor)))

for (k in seq(1,length(acc),decimationFactor))
{
idxs = seq(max(1,k), min(length(acc), k+decimationFactor-1),1)
mx[idx] = max(acc[idxs])
mn[idx] = min(acc[idxs])
idx <- idx + 1
}

par(mfrow=c(1,1))
plot(acc)
points(seq(1,length(acc),decimationFactor),mx,lwd=5,col="green")
points(seq(1,length(acc),decimationFactor),mn,lwd=5,col="red")

• Really helpful, thanks. Just noticed another issue: if the measurements include noise then windows without an impact return the max amplitude of the noise. So statistics of non-impact periods are biased high. Despite these limitations, I still can't think of a better way to record peak statistics in a data vector that is too slow to resolve the peaks.
– KAE
Dec 2 '15 at 17:00
• @KAE You're welcome! The only other possibility is to try for a "gated" approach: If there are no "outlier" acceleration values in the window, just send the mean of the window. If there is an "outlier" send that value instead. The problem then is define what you mean by "outlier". :-)
– Peter K.
Dec 2 '15 at 17:10