Moving AverageI have a table called drugs with columns drug and result, how do I calculate the moving average of the result column by taking the first 4 rows followed by the next 4 rows and similarly continue. Pfa the sample table for reference.
Re: Moving AverageJMP's support documentation gives some additional background for how the formula may be defined (defines the arguments and also includes some nice little examples): https://www.jmp.com/support/help/en/16.2/#page/jmp/statistical-functions-2.shtml#

You can find in Wikipedia (https://en.wikipedia.org/wiki/Moving_average) more on first principles and mathematical/ conceptual understanding behind the Moving Average Calculation:
Re: Moving AverageThanks this workedRe: Moving Averagewhat does weighting = 1, before = 3, :Drug mean?
Could you please explain the formulaRe: Moving Averagethis did not work
Re: Moving Average
I think this will give you the moving average that you want (4 rows before and 4 rows after).
Re: Moving AverageThe formula to use is
If( Mod( Row(), 4 ) == 0,
Mean( :Result[Index( Row() - 3, Row() )] )
)
I have attached your example data table, with a new column with the formula in it

Re: Moving AverageI want to generate the moving average column as shown in the attached table, for every 4 rows I need to calculate the average
Re: Moving AverageDo you have 4 columns of results, or 4 times as many rows as you show in your sample data table?Re: Moving AverageCould you please explain the next step after this, I want to calculate the average of 4 consecutive samplesRe: Moving AverageCreate a new column in your data table, and apply the folloing formula
Col Moving Average( :Result, weighting = 1, before = 3, :Drug )
Re: Moving Averagehello ,
you can try with Formula column --> row --> moving average

Re: Moving AverageThanks Jim!
Just used this method to calculate the difference between the maximum and minimum for the last n rows.
Hope you are doing well!