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
hmarek14
Level I

Please help- Finding seperate averages for spans of data

Hi, I really need help trying to find seperate averages of data using a formula. I created a column that has a span of data, and I need to figure out the average of the data before that span starts (starting after the span before). I got an inverse span data column, but how can I seperate the data between spans to get an average for each section of data?

 

I tried to take the lag of up to five rows before the span starts, but it did not seem to work at all. 

 

I am dying a little inside, please help.

4 REPLIES 4
Highlighted
txnelson
Super User

Re: Please help- Finding seperate averages for spans of data

It would be very helpful to see a sample data table and what you expect the solution to be.

Jim
Highlighted
hmarek14
Level I

Re: Please help- Finding seperate averages for spans of data

SpanRowInverseSpanRowDataPointsInverseSpanAverages

missing

1.5.065
missing1.75.065
3

missing

.8missing
3missing.6missing
3missing.9missing
missing6.34.385
missing6.43.385
Highlighted
dale_lehman
Level VI

Re: Please help- Finding seperate averages for spans of data

I can't exactly tell what you want, but I think this should work: if you can select the spans of rows you want to average over (just select them - or you can use a formula if it will identify the rows you want to span), then Under Row Selection Name Selection in column will create a column of 0 and 1 for the two groups of rows (or you can name them something else). Then, create a formula using the Column Mean function and use a By variable of the column you just created.  This should give you the mean for each span of rows separately.

Highlighted
ms
Super User ms
Super User

Re: Please help- Finding seperate averages for spans of data

Try this column formula:

Col Mean(:DataPoints, :SpanRow || :InverseSpanRow);

Or if you, as in the sample table, wish the output in text format and "missing" spelled out:

If(:SpanRow == "missing",
    Char(Col Mean(:DataPoints, :InverseSpanRow)),
    "missing"
);
Article Labels

    There are no labels assigned to this post.