<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Col formula for iterative means by categories in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Col-formula-for-iterative-means-by-categories/m-p/212726#M42586</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset containing measurements from an experiment measuring the analyte carry-over from a high concentrated sample to the subsequent low concentration samples on a chemical analyzer. I do the experiment on different devices and different reagents, doing three replicate runs for each combination.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To calculate the carry-over level I first do 10 baseline measurements on each device-reagent combination.&lt;/P&gt;&lt;P&gt;I want to make a new column containing the mean of the 10 baseline measurements for the corresponding device-reagent combination. Attached is the data table with the wanted column filled in manually in the "Mean(baseline)" col.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also want a new column that takes the measuments result of the high samples ("H" in col "Sample") and fills in this value for the ten following low samples. Again, see attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some idea of how to hard code the col formulas to device names and sample names, but I would like to do it iteratively, as the real dataset is larger.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2019 09:27:52 GMT</pubDate>
    <dc:creator>olekh</dc:creator>
    <dc:date>2019-06-12T09:27:52Z</dc:date>
    <item>
      <title>Col formula for iterative means by categories</title>
      <link>https://community.jmp.com/t5/Discussions/Col-formula-for-iterative-means-by-categories/m-p/212726#M42586</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset containing measurements from an experiment measuring the analyte carry-over from a high concentrated sample to the subsequent low concentration samples on a chemical analyzer. I do the experiment on different devices and different reagents, doing three replicate runs for each combination.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To calculate the carry-over level I first do 10 baseline measurements on each device-reagent combination.&lt;/P&gt;&lt;P&gt;I want to make a new column containing the mean of the 10 baseline measurements for the corresponding device-reagent combination. Attached is the data table with the wanted column filled in manually in the "Mean(baseline)" col.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also want a new column that takes the measuments result of the high samples ("H" in col "Sample") and fills in this value for the ten following low samples. Again, see attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some idea of how to hard code the col formulas to device names and sample names, but I would like to do it iteratively, as the real dataset is larger.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 09:27:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-formula-for-iterative-means-by-categories/m-p/212726#M42586</guid>
      <dc:creator>olekh</dc:creator>
      <dc:date>2019-06-12T09:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Col formula for iterative means by categories</title>
      <link>https://community.jmp.com/t5/Discussions/Col-formula-for-iterative-means-by-categories/m-p/212758#M42590</link>
      <description>&lt;P&gt;I have attached a data table with two new columns that calculate the Mean(Baseline) and the H Sample.&amp;nbsp; I added them to your attached data table as two new columns.&amp;nbsp; Unless you did not specify your requirements properly, I found that your manually calculated Mean(Baseline) values were not correct for the Reagent/Device Baseline means.&amp;nbsp; They appear to be the mean for the Baseline values for the previous Reagent/Device grouping.&lt;/P&gt;
&lt;P&gt;Here are the formulas I used&lt;/P&gt;
&lt;P&gt;Mean(Baseline)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x = Col Mean( If( :Sample == "Baseline", :Measurement, . ), :Reagent, :Device );
If( :Sample == "Baseline",
	x = .
);
x;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;H Sample&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x = Col Max( :Measurement, :Reagent, :Device );
If( :Sample == "Baseline",
	x = .
);
x;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:40:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-formula-for-iterative-means-by-categories/m-p/212758#M42590</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-06-12T14:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Col formula for iterative means by categories</title>
      <link>https://community.jmp.com/t5/Discussions/Col-formula-for-iterative-means-by-categories/m-p/212769#M42592</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14123"&gt;@olekh&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;If your data is sorted such that the baseline measurements always come before the other runs (within a sample/device/reagent group), which is what you have here, the following is one such column formulas that will do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :Sample == "Baseline",
	Col Mean( :Measurement, :Reagent, :Sample, :Device ),
	Lag( :Name( "Mean(Baseline) Formula" ), 1 )
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I've attached the table with the formula here, too. But, I was a bit confused that the means I got did not match your hardcoded means. I checked manually by calculating the baseline means separately and they didn't match what you had. Is it possible the means you calculated were incorrect? Or perhaps, I'm misunderstanding your data structure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2026"&gt;@jules&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:54:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-formula-for-iterative-means-by-categories/m-p/212769#M42592</guid>
      <dc:creator>jules</dc:creator>
      <dc:date>2019-06-12T14:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Col formula for iterative means by categories</title>
      <link>https://community.jmp.com/t5/Discussions/Col-formula-for-iterative-means-by-categories/m-p/212916#M42607</link>
      <description>Thank you, that is perfect! And you are right about the means, of course.</description>
      <pubDate>Thu, 13 Jun 2019 08:02:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-formula-for-iterative-means-by-categories/m-p/212916#M42607</guid>
      <dc:creator>olekh</dc:creator>
      <dc:date>2019-06-13T08:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Col formula for iterative means by categories</title>
      <link>https://community.jmp.com/t5/Discussions/Col-formula-for-iterative-means-by-categories/m-p/212917#M42608</link>
      <description>Yes, you are right about the means. It seems I was a bit hasty transferring values to the example set. Thanks for your solution!</description>
      <pubDate>Thu, 13 Jun 2019 08:04:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-formula-for-iterative-means-by-categories/m-p/212917#M42608</guid>
      <dc:creator>olekh</dc:creator>
      <dc:date>2019-06-13T08:04:34Z</dc:date>
    </item>
  </channel>
</rss>

