<?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 Re: How to calculate the median for a group of data in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-calculate-the-median-for-a-group-of-data/m-p/554257#M76895</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thank you for suggestion. It is working, however I noticed that I have in data some other even high-level groups for which median within lower-level groups need to be calculated. I slightly adapted the if statement:&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; New Column("Med", Numeric, Continuous, Formula(
	If(Row() == Col Min(Row(), :High_level_Group, :Low_level_Group),
		Col Median(:Param, :High_level_Group, :Low_level_Group)
	,
		.
	)
));&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 10 Oct 2022 08:00:39 GMT</pubDate>
    <dc:creator>lukasz</dc:creator>
    <dc:date>2022-10-10T08:00:39Z</dc:date>
    <item>
      <title>How to calculate the median for a group of data</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-calculate-the-median-for-a-group-of-data/m-p/554166#M76889</link>
      <description>&lt;P&gt;Hello everybody,&lt;BR /&gt;I have test groups A and B, 4 different items, Param2 (being the maximum of Param1 values) saved in the first cell of corresponding item. The values of Param2 are sometimes provided per hand. Now I would like to calculate the median of Param2 for each test group and save it again&lt;BR /&gt;in the first cell where each test group starts, like in the table below. I would appreciate for hints how I can do that in script.&lt;BR /&gt;Thank you and best regards.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jmp_median.JPG" style="width: 490px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/46135i2FD537B9226A849D/image-dimensions/490x314?v=v2" width="490" height="314" role="button" title="jmp_median.JPG" alt="jmp_median.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:55:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-calculate-the-median-for-a-group-of-data/m-p/554166#M76889</guid>
      <dc:creator>lukasz</dc:creator>
      <dc:date>2023-06-10T23:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the median for a group of data</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-calculate-the-median-for-a-group-of-data/m-p/554189#M76890</link>
      <description>&lt;P&gt;Use Col Median to calculate median over groups. Then combine that with if-statement which checks for first row of the group using Col Min&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(8),
	New Column("Group", Character, "Nominal", Set Values({"A", "A", "A", "A", "B", "B", "B", "B"})),
	New Column("Param", Numeric, "Continuous", Format("Best", 12), Set Values([5, ., ., 6, 3, ., 2, .])),
	New Column("Column 4", Numeric, "Continuous", Format("Best", 12), Set Values([., ., ., ., ., ., ., .]))
);


dt &amp;lt;&amp;lt; New Column("Med", Numeric, Continuous, Formula(
	If(Row() == Col Min(Row(), :Group),
		Col Median(:Param, :Group)
	,
		.
	)
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1665327438208.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/46136i5F8942F86BEF8ACF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1665327438208.png" alt="jthi_0-1665327438208.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2022 14:57:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-calculate-the-median-for-a-group-of-data/m-p/554189#M76890</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-10-09T14:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the median for a group of data</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-calculate-the-median-for-a-group-of-data/m-p/554257#M76895</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thank you for suggestion. It is working, however I noticed that I have in data some other even high-level groups for which median within lower-level groups need to be calculated. I slightly adapted the if statement:&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; New Column("Med", Numeric, Continuous, Formula(
	If(Row() == Col Min(Row(), :High_level_Group, :Low_level_Group),
		Col Median(:Param, :High_level_Group, :Low_level_Group)
	,
		.
	)
));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Oct 2022 08:00:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-calculate-the-median-for-a-group-of-data/m-p/554257#M76895</guid>
      <dc:creator>lukasz</dc:creator>
      <dc:date>2022-10-10T08:00:39Z</dc:date>
    </item>
  </channel>
</rss>

