<?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: Corrected mean calculation in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Corrected-mean-calculation/m-p/623943#M82282</link>
    <description>&lt;P&gt;Many thanks Mark, it works well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For future reference for others, using tips from this topic should allow to localise the 4 columns in a wider data table:&lt;BR /&gt;&lt;A href="https://community.jmp.com/t5/Discussions/How-to-get-column-number-from-column-name-JMP/td-p/5987" target="_blank"&gt;https://community.jmp.com/t5/Discussions/How-to-get-column-number-from-column-name-JMP/td-p/5987&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
    <pubDate>Wed, 19 Apr 2023 16:04:40 GMT</pubDate>
    <dc:creator>P_E_Bachara</dc:creator>
    <dc:date>2023-04-19T16:04:40Z</dc:date>
    <item>
      <title>Corrected mean calculation</title>
      <link>https://community.jmp.com/t5/Discussions/Corrected-mean-calculation/m-p/623749#M82262</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I struggle to calculate a "corrected mean" out of&amp;nbsp;4 result columns with continuous numerical values that I get.&lt;/P&gt;&lt;P&gt;How I define the "corrected mean"?&amp;nbsp;I want to exclude the value which is the furthest away from the mean and double count the value closest to it (effectively replacing the excluded "outlier" with the value closes to it).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See example below where excluded values are highlighted in red and duplicated ones in green.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="P_E_Bachara_0-1681896382774.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/52080i2728179B31B81D77/image-size/medium?v=v2&amp;amp;px=400" role="button" title="P_E_Bachara_0-1681896382774.png" alt="P_E_Bachara_0-1681896382774.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your support! (I'm currently on JMP 17.0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find script with the sample raw data below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "corrected_mean_script",
	Add Rows( 10 ),
	New Column( "R1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Color Cells( {36, {1, 10}} ),
		Set Values( [50.7, 54.5, 53.7, 54.5, 51.4, 47.6, 50.8, 51.4, 47.1, 53.1] )
	),
	New Column( "R2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Color Cells( {{36, {3, 8}}, {3, {5, 6, 9}}} ),
		Set Values( [49.2, 55.4, 51.3, 54.8, 55.3, 53.7, 51.6, 51.2, 51.8, 50.3] ),
		Set Display Width( 48 )
	),
	New Column( "R3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Color Cells( {{3, {1, 2, 4}}, {36, {5, 7}}} ),
		Set Values( [54.7, 50.3, 55.1, 51.3, 52.9, 48.2, 53, 52.8, 44.1, 51.6] )
	),
	New Column( "R4",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Color Cells( {{36, {2, 4, 6, 9}}, {3, {3, 7, 8, 10}}} ),
		Set Values( [50.3, 52, 49.8, 52.9, 50.5, 52.1, 54.3, 44.8, 48.6, 55.3] ),
		Set Display Width( 50 )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 11 Jun 2023 00:00:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Corrected-mean-calculation/m-p/623749#M82262</guid>
      <dc:creator>P_E_Bachara</dc:creator>
      <dc:date>2023-06-11T00:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Corrected mean calculation</title>
      <link>https://community.jmp.com/t5/Discussions/Corrected-mean-calculation/m-p/623898#M82278</link>
      <description>&lt;P&gt;Here is one way, in steps, to see a solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = New Table( "corrected_mean_script",
	Add Rows( 10 ),
	New Column( "R1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Color Cells( {36, {1, 10}} ),
		Set Values( [50.7, 54.5, 53.7, 54.5, 51.4, 47.6, 50.8, 51.4, 47.1, 53.1] )
	),
	New Column( "R2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Color Cells( {{36, {3, 8}}, {3, {5, 6, 9}}} ),
		Set Values( [49.2, 55.4, 51.3, 54.8, 55.3, 53.7, 51.6, 51.2, 51.8, 50.3] ),
		Set Display Width( 48 )
	),
	New Column( "R3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Color Cells( {{3, {1, 2, 4}}, {36, {5, 7}}} ),
		Set Values( [54.7, 50.3, 55.1, 51.3, 52.9, 48.2, 53, 52.8, 44.1, 51.6] )
	),
	New Column( "R4",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Color Cells( {{36, {2, 4, 6, 9}}, {3, {3, 7, 8, 10}}} ),
		Set Values( [50.3, 52, 49.8, 52.9, 50.5, 52.1, 54.3, 44.8, 48.6, 55.3] ),
		Set Display Width( 50 )
	)
);

dt &amp;lt;&amp;lt; New Column( "Corrected Mean", Numeric, "Continuous" );

For Each Row(
	mean = Mean( :R1, :R2, :R3, :R4 );
	data = dt[Row(), 1::4];
	absDiff = Abs( data - mean );
	min = (data[Loc( absDiff == Min( absDiff ) )])[1];
	data[Loc( absDiff == Max( absDiff ) )[1]] = min;
	:Corrected Mean = Mean( data );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Apr 2023 15:00:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Corrected-mean-calculation/m-p/623898#M82278</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-04-19T15:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Corrected mean calculation</title>
      <link>https://community.jmp.com/t5/Discussions/Corrected-mean-calculation/m-p/623943#M82282</link>
      <description>&lt;P&gt;Many thanks Mark, it works well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For future reference for others, using tips from this topic should allow to localise the 4 columns in a wider data table:&lt;BR /&gt;&lt;A href="https://community.jmp.com/t5/Discussions/How-to-get-column-number-from-column-name-JMP/td-p/5987" target="_blank"&gt;https://community.jmp.com/t5/Discussions/How-to-get-column-number-from-column-name-JMP/td-p/5987&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 16:04:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Corrected-mean-calculation/m-p/623943#M82282</guid>
      <dc:creator>P_E_Bachara</dc:creator>
      <dc:date>2023-04-19T16:04:40Z</dc:date>
    </item>
  </channel>
</rss>

