Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
RVhydrA
Level III

Equation involving lag values - fix issue at beginning of data set

I have a timeseries data set and am using what in my field we refer to as a digital filter to smooth the data. I have water level data and it can be quite noisy so the filter acts as a smoother. I use the following equation: (Summation( i = 1, 96, Lag( :Water, i ) ) +Summation( i = -1, 96, Lag( :Water, i ) )) / 192. The equation is looking forward 96 rows and backwards 96 rows and taking the average. The equation works just fine except for at the beginning of the dataset... for rows less than 96 it tails off to 0. How can I either adjust the equation or add to say If row < 96 then only take the average of row 1 through row i (i being a value between 2 and 95)

1 REPLY 1
Highlighted
Thierry_S
Level VI

Re: Equation involving lag values - fix issue at beginning of data set

Hi,
Have you considered replacing the upper limit of your i value from 96 to a statement like: If(row () < 96, j=Row(), 96);
I have not had the chance to test it so it might not address your specific issue.
Best,
TS
Thierry R. Sornasse