<?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 do I perform a 2-sample Hotelling's T-square test in JMP? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/730101#M91287</link>
    <description>&lt;P&gt;Dear Jim&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could I persuade you to post the SAS code as well? That would be most helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2024 21:10:44 GMT</pubDate>
    <dc:creator>Blaedel</dc:creator>
    <dc:date>2024-03-05T21:10:44Z</dc:date>
    <item>
      <title>How do I perform a 2-sample Hotelling's T-square test in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/686298#M87210</link>
      <description>&lt;P&gt;I'm trying to compare multiple different product specs or variables (k = 8)&lt;/img&gt; between 2 different groups. I can't find a way to compare those multiple factors between the 2 groups easily in JMP right now using the 2-sample Hotelling's T-square test. I'd also like to know if JMP can then create the CIs if we reject the Hotelling's T2 test statistic and also review the profile plots?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 21:02:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/686298#M87210</guid>
      <dc:creator>mjz5448</dc:creator>
      <dc:date>2023-10-11T21:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I perform a 2-sample Hotelling's T-square test in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/686350#M87215</link>
      <description>&lt;P&gt;I found some SAS code on the internet that performed the 2 Sample Hotelling T2 calculation.&amp;nbsp; I converted the code to JSL.&amp;nbsp; I tested it against some sample data and it checked out ok.&amp;nbsp; It is a bit clunking but it works.&amp;nbsp; Take a look at the annotation in the JSL to see what needs to be set to work with your data.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1697086322772.png" style="width: 811px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57530iAFBD8FA7C9E32B0C/image-dimensions/811x357?v=v2" width="811" height="357" role="button" title="txnelson_0-1697086322772.png" alt="txnelson_0-1697086322772.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Open the data table
dt = open("$SAMPLE_DATA/Prostate Cancer.jmp");

groupVar = "Status"; // Enter the grouping column name
groupList = {"CCD", "Nor"}; // Set the values for the 2 groups

startColumn = 660;  // Set the starting column number for the data to be included

// Create the group 1 and group 2 matrices for analysis
gp1Rows = dt &amp;lt;&amp;lt; get rows where( as column( groupVar) == groupList[1] );
group1 = dt[gp1Rows, startColumn :: N Cols( dt )];

gp1Rows = dt &amp;lt;&amp;lt; get rows where( as column( groupVar ) == groupList[2] );
group2 = dt[gp1Rows, startColumn :: N Cols( dt )];

// Get the dimensions of the matricies
nRows1 = N Row( group1 );
nRows2 = N Row( group2 );
numCols = N Col( group1 );

// Create a filled vector for the analysis
j1 = J( nRows1, 1, 1 );
j2 = J( nRows2, 1, 1 );

// Create an identity matrix for each group
identity1 = Identity( nRows1 );
identity2 = Identity( nRows2 );

// Calculate the means for each of the columns by each group
MeanY1 = group1` * j1 / nRows1;
MeanY2 = group2` * j2 / nRows2;

// Create an output window to display the results in
nw = New Window("Hotelling T2", outlinebox("Hotelling 2 Sample T2 Analysis",spacerbox(size(1,15)),lub = vlistbox()));

// Add the means table to the output
obMean = Outline Box("Group Means",
	mTB = Table Box(
		string Col box("Groups", groupList),
		number col box("# Rows", matrix(nRows1)||matrix(nRows2))
	)
);
for(i=startColumn, i&amp;lt;=NCols(dt),i++,
	mTB &amp;lt;&amp;lt; append(number col box(column(dt,i)&amp;lt;&amp;lt;get name, MeanY1[i-startColumn+1] || MeanY2[i-startColumn+1]))
		);
lub&amp;lt;&amp;lt;append(obMean);
lub&amp;lt;&amp;lt;append(spacerbox(size(1,15)));

// Create the Sample Variance-Covariance matrix for group 1
sampVarCovarGp1 = group1` * (identity1 - j1 * j1` / nRows1) * group1 / (nRows1 - 1.0);

// Add the matrix to the output window
obSVCG1 = Outline Box("Sample Variance-Covariance for Group = " || groupList[1],
	SVCG1 = TableBox()
);
for(i=1,i&amp;lt;=ncols(sampVarCovarGp1),i++,
	SVCG1 &amp;lt;&amp;lt; append(numbercolbox("", sampVarCovarGp1[0,i]))
);
lub&amp;lt;&amp;lt;append(obsvcg1);
lub&amp;lt;&amp;lt;append(spacerbox(size(1,15)));
obSVCG1 &amp;lt;&amp;lt; close;

// Create the Sample Variance-Covariance matrix for group 2
sampVarCovarGp2 = group2` * (identity2 - j2 * j2` / nRows2) * group2 / (nRows2 - 1.0);

// Add the matrix to the output window
obSVCG2 = Outline Box("Sample Variance-Covariance for Group = " || groupList[2],
	SVCG2 = TableBox()
);
for(i=1,i&amp;lt;=ncols(sampVarCovarGp2),i++,
	SVCG2 &amp;lt;&amp;lt; append(numbercolbox("", sampVarCovarGp2[0,i]))
);
lub&amp;lt;&amp;lt;append(obsvcg2);
lub&amp;lt;&amp;lt;append(spacerbox(size(1,15)));
obSVCG2 &amp;lt;&amp;lt; close;

// Create the Pooled Sample Variance-Covariance matrix
sampPool = ((nRows1 - 1.0) * sampVarCovarGp1 + (nRows2 - 1.0) * sampVarCovarGp2) / (nRows1 + nRows2 - 2.0);

// Add the matrix to the output window
obSampPool = Outline Box("Pooled Variance-Covariance Matrix",
	sampPooltb = TableBox()
);
for(i=1,i&amp;lt;=ncols(sampPool),i++,
	sampPooltb &amp;lt;&amp;lt; append(numbercolbox("", sampPool[0,i]))
);
lub&amp;lt;&amp;lt;append(obSampPool);
lub&amp;lt;&amp;lt;append(spacerbox(size(1,15)));
obSampPool &amp;lt;&amp;lt; close;

// Calculate the result statistics
t2 = (MeanY1 - MeanY2)` * Inv( sampPool * (1 / nRows1 + 1 / nRows2) ) * (MeanY1 - MeanY2);
f = (nRows1 + nRows2 - numCols - 1) * t2 / numCols / (nRows1 + nRows2 - 2);
degFreedomGp1 = numCols;
degFreedomGp2 = nRows1 + nRows2 - numCols - 1;
pValue = 1 - F Distribution( f, degFreedomGp1, degFreedomGp2 );

// Add the results to the display window
obFinal = Outline Box("Results",
	tablebox(
		stringcolbox("Group", groupList),
		numbercolbox("DF", matrix(degFreedomGp1)||matrix(degFreedomGp2)),
		numbercolbox("T2", matrix(t2)),
		numbercolbox("F", matrix(f)),
		pv=numbercolbox("pValue",matrix(pValue))
	)
);
pv&amp;lt;&amp;lt;set format("pvalue");
lub&amp;lt;&amp;lt;append(obFinal);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 12:03:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/686350#M87215</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-10-12T12:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I perform a 2-sample Hotelling's T-square test in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/686464#M87229</link>
      <description>&lt;P&gt;Thank you for the response. I didn't think to try finding a solution using SAS.&amp;nbsp; Now that I think about it I may have SAS code for doing a multivariate comparison between 2 groups that may also work. That said, I was hoping someone knew if: analyze &amp;gt; fit model menu &amp;gt; Manova , could work multivariate comparison of just 2 groups instead of multiple ones?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 13:21:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/686464#M87229</guid>
      <dc:creator>mjz5448</dc:creator>
      <dc:date>2023-10-12T13:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I perform a 2-sample Hotelling's T-square test in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/686609#M87231</link>
      <description>&lt;P&gt;From JMP Help:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tsqr.PNG" style="width: 291px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57551i8392AC56381976BF/image-size/large?v=v2&amp;amp;px=999" role="button" title="tsqr.PNG" alt="tsqr.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 14:38:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/686609#M87231</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-10-12T14:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I perform a 2-sample Hotelling's T-square test in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/686645#M87233</link>
      <description>&lt;P&gt;Thanks Mark. I saw that 1-sample T2 test option under the multivariate menu, but couldn't find anything for a 2-sample test - which is what I'm looking for to compare product specs between 2 groups. I think I may playing around w/ the MANOVA option but use 2 groups instead of the 3+ groups it usually calls for &amp;amp; see if I can get the correct outputs.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 17:59:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/686645#M87233</guid>
      <dc:creator>mjz5448</dc:creator>
      <dc:date>2023-10-12T17:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I perform a 2-sample Hotelling's T-square test in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/687708#M87328</link>
      <description>&lt;P&gt;For those that are interested - I THINK (someone may need to verify) you can use the MANOVA option to perform a 2-sample Hotelling's T2 analysis as follows:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Analyze &amp;gt; Fit Model &amp;gt; select all of your response variables you are trying compare between your 2 groups &amp;amp; move them to "Y", select the column containing your labels for your 2 groups select "Add" under 'Construct Model Effects' &amp;gt; select "Manova" from the 'Personality' dropdown menu &amp;gt; Run &amp;gt; under 'Choose Response' menu, select "Identity" &amp;gt; Run.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;This should output your F-value and probability for your test.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I'm not sure how to do the simultaneous or Bonferroni adjusted intervals from here.&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 16 Oct 2023 14:48:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/687708#M87328</guid>
      <dc:creator>mjz5448</dc:creator>
      <dc:date>2023-10-16T14:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I perform a 2-sample Hotelling's T-square test in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/730101#M91287</link>
      <description>&lt;P&gt;Dear Jim&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could I persuade you to post the SAS code as well? That would be most helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 21:10:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/730101#M91287</guid>
      <dc:creator>Blaedel</dc:creator>
      <dc:date>2024-03-05T21:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I perform a 2-sample Hotelling's T-square test in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/730126#M91291</link>
      <description>&lt;P&gt;Here is a link to a SAS example.&amp;nbsp; I believe this is the example I used, but I am not sure.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://online.stat.psu.edu/stat505/lesson/7/7.1/7.1.15#:~:text=Explore%20the%20code%20below%20to%20see%20how%20to,the%20SAS%20statistical%20software%20application.%20the%20code%3A%20swiss10.sas" target="_blank"&gt;7.1.15 - The Two-Sample Hotelling's T-Square Test Statistic | STAT 505 (psu.edu)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 01:09:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-perform-a-2-sample-Hotelling-s-T-square-test-in-JMP/m-p/730126#M91291</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-03-06T01:09:11Z</dc:date>
    </item>
  </channel>
</rss>

