- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Formula to filter data by final vs initial concentration?
I'm looking for a way to filter data on a graph to only include data that is accumulating or depleting. The simple version of this is accumulating = concentration at final timepoint > concentration at initial timepoint (or < if depleting). It however gets slightly more complicated due to the fact that the final timepoint will not always be the same - some data sets may be over the course of 12 days, some may be 14, etc. It's also common for each timepoint to really be 3 replicates, so being able to use the average of those when deciding if things are accumulating or depleting would be ideal (if not, it likely wouldn't matter much). In the included image for example, I would want to be able to filter and just show the blue line for accumulating analytes. Any help getting started would be appreciated! My goal is to have a column with an output of "accumulating" or "depleting", that way it can just be added to the data filter. Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Formula to filter data by final vs initial concentration?
Col Mean() and other similar Col functions (Col Min, Col Max,...) might be helpful. If you could provide example data with one column indicating correct answers, it would make it possible to provide example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Formula to filter data by final vs initial concentration?
Hi, I've attached a transformed/simplified version of the data type I'm working with, if that helps. I'm aware of the Col functions, but I've struggled getting things to piece together in a way that works
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Formula to filter data by final vs initial concentration?
As there was no "correct" answer column provided, I made guesses. This script will create formula columns which should help building the final column. There are also other options when using formulas or you could use completely different method than just formulas
Names Default To Here(1);
dt = Open("$DOWNLOADS/Sample Data for JMP Forum.jmp");
dt << Sort(By(:Time), Order(Ascending), Replace Table); // to make this a bit simpler sort by :Time
// Assumption: Time and Analyte create a group
dt << New Column("Mean_TimeAnalyte", Numeric, Continuous, Formula(
Col Mean(:"Concentration (mM)"n, :Time, :Analyte)
));
// Assumption: We are looking for first and last average value for each Analyte
dt << New Column("FirstAnalyteValue", Numeric, Continuous, Formula(
Col Sum(
If(Row() == Col Min(Row(), :Analyte),
:Mean_TimeAnalyte
,
0
),
:Analyte
)
));
dt << New Column("LastAnalyteValue", Numeric, Continuous, Formula(
Col Sum(
If(Row() == Col Max(Row(), :Analyte),
:Mean_TimeAnalyte
,
0
),
:Analyte
)
));
dt << New Column("AnalyteStatus", Numeric, Continuous, Formula(
If(:LastAnalyteValue > :FirstAnalyteValue,
"Accumulating"
,
"Depleting"
);
));
gb = dt << Graph Builder(
Size(528, 492),
Show Control Panel(0),
Variables(
X(:Time),
Y(:"Concentration (mM)"n),
Group X(:AnalyteStatus),
Overlay(:Analyte)
),
Elements(
Points(X, Y, Legend(5), Summary Statistic("Mean")),
Line(X, Y, Legend(6))
),
Local Data Filter(Add Filter(columns(:AnalyteStatus)))
);