Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-4-20250514-thinking-32k· AnthropicHugging Face LMArena Human Preference 140K

Does is make sense to calculate a median value of moving medians?

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with o4-mini-2025-04-16’s answer.
  1. User

    Does is make sense to calculate a median value of moving medians?

  2. Claude Assistant

    It can make sense in specific contexts, but it's not always the right choice. Here's when it does and doesn't make sense:

    When it makes sense:

    Time series with local structure - If you have data where local trends matter more than global patterns (like sensor readings, stock prices, or biological signals), the median-of-moving-medians captures "typical local behavior" rather than just overall center.

    Double robustness - You get protection against both short-term spikes (via moving median) AND long-term outliers (via the final median). This can be valuable for noisy data with multiple types of contamination.

    Characterizing filtered data - Sometimes you genuinely want to know "what's the central tendency of my smoothed signal?" rather than the raw data's center.

    When it doesn't make sense:

    Simple central tendency - If you just want to know the middle value of your dataset, a straight median is clearer, faster, and more interpretable.

    Over-smoothing risk - You're applying two levels of robustness, which might wash out legitimate variations you care about.

    Window size sensitivity - The result becomes heavily dependent on your window choice, adding an arbitrary parameter.

    Loss of interpretability - The final number doesn't directly correspond to any percentile of your original data.

    Better alternatives might include:

    • Trimmed means of moving medians
    • Median with different window sizes to check stability
    • Robust regression approaches for trend extraction

    The key question is: are you trying to summarize your raw data, or summarize the behavior of a smoothed version? If the latter, then median-of-moving-medians can be quite reasonable.

  3. User

    I need to detect approximate "normal" state of a sensor, given that its reading fluctuate over time. The data may have temporary "bumps" of increased or decreased reading that I need to ignore or smoothen.

  4. Claude Assistant

    For sensor anomaly detection and finding "normal" state, median-of-moving-medians actually makes a lot of sense. Here's why it's well-suited to your problem:

    Why it works for sensor data:

    Two-stage robustness - The moving median eliminates temporary spikes/dips in each local window, then the final median gives you the "typical" value from those cleaned local estimates. This is much more robust than a global median, which could be pulled toward persistent anomalies.

    Handles different anomaly types - Works whether you have brief spikes, sustained periods of drift, or intermittent sensor malfunctions.

    Time-aware - Unlike a simple global statistic, it respects the temporal structure of your data.

    Practical recommendations:

    Window size - Start with a window that's 2-3x the typical duration of the "bumps" you want to smooth out. If bumps last ~10 readings, try window size 20-30.

    Alternative approaches to consider:

    • Rolling percentiles (e.g., 25th-75th percentile of moving windows) to get a normal "range"
    • Robust moving averages (trimmed mean of moving windows)
    • Isolation forest or z-score methods if you need to identify the anomalies themselves
    • Running median with outlier detection - flag readings that deviate significantly from recent median

    Quick implementation strategy:

    1. Apply moving median with appropriate window size
    2. Take median of the filtered series as your "normal" baseline
    3. Optionally, use this baseline to identify anomalies (readings that deviate significantly from recent moving medians)

    For sensor monitoring, this approach is both principled and practical.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.