Sliding window average

Welcome to our Forums Technical Support Getting Started Sliding window average

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7862
    jib
    Participant

      I’d like to compute an average of a data column using a sliding window with varying size of the window. For example;

      Data, Ave2
      1, 0
      2, 1.5
      3, 2.5
      4, 3.5
      5, 4.5
      3, 4
      4, 3.5
      2, 3
      1, 1.5

      The Ave2 column is the average of a sliding window of 2 values from ‘data’ – I’d like to use a slider to vary the window width. Any how, I have not been able to figure out how to do even a fixed window size sliding average.

      #7879
      kirkt
      Participant

        Maybe the “Smooth” Plot Action will work – see pages 28-29 of the PDF manual.  The three different techniques used in the Smooth plot action (simple moving average, weighted moving average, exponential moving average) are discussed here:

        https://en.wikipedia.org/wiki/Moving_average#Simple_moving_average

         

        Kirk

        #7880
        dgteam
        Moderator

          Yes – the Smooth option in the Plot Action column will do this. (Thanks Kirk!)

          @jib Here you can see the result with your data.  In the table, the calculated average you sent is compared to ‘Smooth 2’ from the Plot action column.  The first row is different as the logic here is that when the row number < the window, the number of averaged values will equal the row number.

          smooth2

          FYI – Note that smoothing like like this can result in a lag on the x axis.  The LOESS Fit is another type of smoothing operation that is included in the Fit command that helps to solve this problem.

          #7883
          jib
          Participant

            “Plot Action” arrgghh, how could I have missed this !   The problem I needed this smoothing/averaging for an audience who is not too familiar with this sort-a-thang. So I wanted to be able to explain it in simple terms if questions arose, the LOESS operator would go right over their head. But as luck would have it, I had to do a quick intro with this presentation and used LOESS as I wasn’t able to do it any other way.

            Nobody asked questions, all impressed with the plots. Engineering/research power over financial types (devilish grin on my face).

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.

          Welcome to our Forums Technical Support Getting Started Sliding window average