<?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: Compare means test: graph probability by difference in means in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Compare-means-test-graph-probability-by-difference-in-means/m-p/423905#M67310</link>
    <description>&lt;P&gt;It does not look like this is possible today, if anyone else is interested in producing similar graphs I added a wish-list item over here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-MESSAGE title="Add superiority test to oneway analyses indicating the probability of being superior by different margins." uid="423900" url="https://community.jmp.com/t5/JMP-Wish-List/Add-superiority-test-to-oneway-analyses-indicating-the/m-p/423900#U423900" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Oct 2021 14:36:45 GMT</pubDate>
    <dc:creator>ih</dc:creator>
    <dc:date>2021-10-06T14:36:45Z</dc:date>
    <item>
      <title>Compare means test: graph probability by difference in means</title>
      <link>https://community.jmp.com/t5/Discussions/Compare-means-test-graph-probability-by-difference-in-means/m-p/419514#M66848</link>
      <description>&lt;P&gt;Is there an interactive method in JMP to determine whether the means of two populations differ by at least a certain amount, or more generally to graph a p value or probability by the minimum difference in means?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example: in the big class data set, show the likelihood that females are shorter than meals by at least X, similar to the table and chart below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ih_0-1632240007194.png" style="width: 810px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35974i1113C35EA992F79B/image-dimensions/810x316?v=v2" width="810" height="316" role="button" title="ih_0-1632240007194.png" alt="ih_0-1632240007194.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This may or may not be the best way to quantify this, but here is a script to create the above table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);

dt = Open("$Sample_data/Big Class.jmp");

// Column to adjust the difference in means between levels
nc = dt &amp;lt;&amp;lt; New Column("height differenced", Numeric, "Continuous", Format("Best", 12), Formula(Parameter({b0 = 5}, If(:sex == "F", :height + b0, :height))));

distances = index(-2,7,incr=.5);
pvalless = {};
pvalmore = {};
for(d=1, d&amp;lt;= n items(distances), d++,
	dist = distances[d];
	Eval( Eval Expr( nc &amp;lt;&amp;lt; Set Formula( Parameter({b0 = expr( dist ) }, If(:sex == "F", :height + b0, :height))) ) );
	ow = dt &amp;lt;&amp;lt; Oneway(
		Y( nc ),
		X( :sex ),
		Means( 1 ),
		t Test( 1 ),
		Mean Diamonds( 1 ),
		SendToReport( Dispatch( {}, "t Test", OutlineBox, {Close( 1 )} ) )
	);
	
	//Extract the prob
	pvalless[d] = ((ow &amp;lt;&amp;lt; XPath("//OutlineBox[text()='Pooled t Test']"))[1][NumberColBox(4)] &amp;lt;&amp;lt; get as matrix)[2];
	pvalmore[d] = ((ow &amp;lt;&amp;lt; XPath("//OutlineBox[text()='Pooled t Test']"))[1][NumberColBox(4)] &amp;lt;&amp;lt; get as matrix)[3];
	
	ow &amp;lt;&amp;lt; close window;
);


dtSum = New Table( "Results",
	Add Rows( n items(distances) ),
	New Column( "Distance",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( distances )
	),
	New Column( "pvalueless",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( pvalless )
	),
	New Column( "pvaluemore",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( pvalmore )
	)
);

gb = dtSum &amp;lt;&amp;lt; Graph Builder(
	Size( 876, 379 ),
	Show Control Panel( 0 ),
	Variables( X( :Distance ), Y( :pvalueless ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Line( X, Y, Legend( 5 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"pvalueless",
			ScaleBox,
			{Add Ref Line( 0.05, "Solid", "Black", ".05", 1 )}
		),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model( 3, Base( -1, 0, 0, Item ID( "pvaluemore", 1 ) ) )}
		),
		Dispatch(
			{},
			"graph title",
			TextEditBox,
			{Set Text(
				"Likelihood of average heights of females being shorter than males by different amounts"
			)}
		),
		Dispatch(
			{},
			"X title",
			TextEditBox,
			{Set Text( "Minimum Distance Between Average Heights" )}
		),
		Dispatch( {}, "Y title", TextEditBox, {Set Text( "p value" )} ),
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Add Line Annotation(
				Line( {233, 222}, {277, 286} ),
				Color( "Magenta" ),
				Thick( 1 ),
				Point to( 1 )
			), Add Text Annotation(
				Text(
					"6% chance that females are not 1 or more inches shorter than males"
				),
				Fixed Size( 0 ),
				Text Box( {43, 175, 332, 237} ),
				Filled( 0 ),
				Text Color( "Medium Dark Magenta" ),
				"Font"("Segoe UI", 12, "Bold")
			), Add Text Annotation(
				Text(
					"34% likelihood that females are not 2.5 or more inches shorter than males"
				),
				Fixed Size( 0 ),
				Text Box( {142, 101, 454, 163} ),
				Filled( 0 ),
				Text Color( "Medium Dark Magenta" ),
				Background Color( "White" ),
				"Font"("Segoe UI", 12, "Bold")
			), Add Line Annotation(
				Line( {353, 149}, {409, 203} ),
				Color( "Magenta" ),
				Thick( 1 ),
				Point to( 1 )
			), Add Text Annotation(
				Text(
					"Highly unlikely that females are 
6 or more inches shorter than males"
				),
				Fixed Size( 0 ),
				Text Box( {537, 98, 826, 152} ),
				Filled( 0 )
			), Add Line Annotation(
				Line( {678, 93}, {711, 27} ),
				Color( "Magenta" ),
				Thick( 1 ),
				Point to( 1 )
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;Another way to calculate this in JMP 17 is using the superiority test:&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);

dt=open("$Sample_Data/Big class.jmp");
obj=Oneway( Y( :height ), X( :sex ));

//add an equivalence test for each distance and get p values for all
distances =index(0.5,7,0.5);
for each( {d}, distances,  obj &amp;lt;&amp;lt; Equivalence Tests( d, 0.05, "Pooled Variance", "Noninferiority Greater" ));
pvalboxes = (obj &amp;lt;&amp;lt; XPath("//NumberColBox[NumberColBoxHeader[contains(text(),'Lower Bound p-Value')]][NumberColBoxItem]"));

//convert p values to match other graph (maybe pulled wrong value from test or used wrong test..)
pvalmore = transform each( {b}, pvalboxes, b[1]);

dtSum = New Table( "Results Superiority Tests",
	Add Rows( n items(distances) ),
	New Column( "Distance",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( distances )
	),
	New Column( "pvaluemore",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( pvalmore )
	),
	New Column( "pvalueless",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( 1 - :pvaluemore )
	)
);

gb = dtSum &amp;lt;&amp;lt; Graph Builder(
	Size( 876, 379 ),
	Show Control Panel( 0 ),
	Variables( X( :Distance ), Y( :pvalueless ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Line( X, Y, Legend( 5 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"pvalueless",
			ScaleBox,
			{Add Ref Line( 0.05, "Solid", "Black", ".05", 1 )}
		),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model( 3, Base( -1, 0, 0, Item ID( "pvaluemore", 1 ) ) )}
		),
		Dispatch(
			{},
			"graph title",
			TextEditBox,
			{Set Text(
				"Likelihood of average heights of females being shorter than males by different amounts"
			)}
		),
		Dispatch(
			{},
			"X title",
			TextEditBox,
			{Set Text( "Minimum Distance Between Average Heights" )}
		),
		Dispatch( {}, "Y title", TextEditBox, {Set Text( "p value" )} )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Fri, 09 Jun 2023 00:39:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Compare-means-test-graph-probability-by-difference-in-means/m-p/419514#M66848</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2023-06-09T00:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Compare means test: graph probability by difference in means</title>
      <link>https://community.jmp.com/t5/Discussions/Compare-means-test-graph-probability-by-difference-in-means/m-p/423905#M67310</link>
      <description>&lt;P&gt;It does not look like this is possible today, if anyone else is interested in producing similar graphs I added a wish-list item over here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-MESSAGE title="Add superiority test to oneway analyses indicating the probability of being superior by different margins." uid="423900" url="https://community.jmp.com/t5/JMP-Wish-List/Add-superiority-test-to-oneway-analyses-indicating-the/m-p/423900#U423900" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 14:36:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Compare-means-test-graph-probability-by-difference-in-means/m-p/423905#M67310</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2021-10-06T14:36:45Z</dc:date>
    </item>
  </channel>
</rss>

