<?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: Mann-Kendall Evaluation in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Mann-Kendall-Evaluation/m-p/975581#M110651</link>
    <description>&lt;P&gt;A quick bit of "Claude"-ing comes up with this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// =====================================================================
// Mann-Kendall Trend Test + Sen's Slope (JSL)
// ---------------------------------------------------------------------
// Code created by Claude (Anthropic).
// Prompt summary: User asked for a JSL script that performs the
// Mann-Kendall test for monotonic trend in a time series (S statistic,
// tie-corrected variance, Z, p-value, Kendall's tau) plus Sen's slope
// with a confidence interval.
////
// Usage: open a data table, run this script, pick the response column
// (required), an optional time/order column, and alpha.
// =====================================================================

Names Default To Here( 1 );

// ---------------------------------------------------------------------
// Helper: Sign( v ) returns +1 if v &amp;gt; 0, -1 if v &amp;lt; 0, and 0 if v == 0
// ---------------------------------------------------------------------
Sign = Function( {v},
	If( v &amp;gt; 0, 1, v &amp;lt; 0, -1, 0 )
);

// ---------------------------------------------------------------------
// STEP 1: Select data table and columns
// ---------------------------------------------------------------------
dt = Current Data Table();
If( Is Empty( dt ),
	Throw( "Open a data table before running this script." )
);

dlg = Column Dialog(
	yCol = ColList( "Y, Response", Max Col( 1 ), Min Col( 1 ), Data Type( Numeric ) ),
	xCol = ColList( "Time / Order (optional; row order used if blank)", Max Col( 1 ) ),
	HList( "Alpha", alphaBox = EditNumber( 0.05 ) )
);
If( dlg["Button"] == -1, Throw( "Cancelled." ) );

yCol = dlg["yCol"];
xCol = dlg["xCol"];
alpha = dlg["alphaBox"];

yName = Column( dt, yCol[1] ) &amp;lt;&amp;lt; Get Name;
hasX = N Items( xCol ) &amp;gt; 0;
If( hasX, xName = Column( dt, xCol[1] ) &amp;lt;&amp;lt; Get Name, xName = "Observation Order" );

// ---------------------------------------------------------------------
// STEP 2: Pull values, drop missing, and sort by time/order
// ---------------------------------------------------------------------
yAll = Column( dt, yName ) &amp;lt;&amp;lt; Get Values;
nAll = N Rows( yAll );
If( hasX,
	xAll = Column( dt, xName ) &amp;lt;&amp;lt; Get Values,
	xAll = 1 :: nAll // row order as time index
);

keep = {};
For( i = 1, i &amp;lt;= nAll, i++,
	If( !Is Missing( yAll[i] ) &amp;amp; !Is Missing( xAll[i] ),
		Insert Into( keep, i )
	)
);
n = N Items( keep );
If( n &amp;lt; 4, Throw( "Need at least 4 non-missing observations." ) );

y = J( n, 1, . );
x = J( n, 1, . );
For( i = 1, i &amp;lt;= n, i++,
	y[i] = yAll[keep[i]];
	x[i] = xAll[keep[i]];
);

ord = Rank( x ); // indices that sort x ascending
y = y[ord];
x = x[ord];

// ---------------------------------------------------------------------
// STEP 3: Mann-Kendall S statistic and Sen's pairwise slopes
// ---------------------------------------------------------------------
nPairs = n * (n - 1) / 2;
slopes = J( nPairs, 1, . );
S = 0;
k = 0;
For( i = 1, i &amp;lt; n, i++,
	For( j = i + 1, j &amp;lt;= n, j++,
		S += Sign( y[j] - y[i] ); // +1 up, -1 down, 0 tie
		If( x[j] != x[i], // skip pairs with identical time stamps
			k++;
			slopes[k] = (y[j] - y[i]) / (x[j] - x[i]);
		);
	)
);
slopes = slopes[1 :: k]; // trim unused preallocated slots
nSlopes = k;

// ---------------------------------------------------------------------
// STEP 4: Tie-corrected variance of S
// ---------------------------------------------------------------------
ySorted = Sort Ascending( y );
tieTerm = 0;
runLen = 1;
For( i = 2, i &amp;lt;= n + 1, i++,
	If( i &amp;lt;= n &amp;amp; ySorted[i] == ySorted[i - 1],
		runLen += 1, // still inside a tied group
		If( runLen &amp;gt; 1, tieTerm += runLen * (runLen - 1) * (2 * runLen + 5) );
		runLen = 1;
	)
);
varS = (n * (n - 1) * (2 * n + 5) - tieTerm) / 18;

// ---------------------------------------------------------------------
// STEP 5: Z statistic (continuity corrected), p-value, Kendall's tau
// ---------------------------------------------------------------------
If( S &amp;gt; 0,
	Z = (S - 1) / Sqrt( varS ),
	S &amp;lt; 0,
	Z = (S + 1) / Sqrt( varS ),
	Z = 0
);
pValue = 2 * (1 - Normal Distribution( Abs( Z ) ));
tau = S / nPairs; // simple tau (not tau-b); equals tau-b when no ties
zCrit = Normal Quantile( 1 - alpha / 2 );

If( pValue &amp;lt; alpha,
	If( Z &amp;gt; 0, trendText = "Significant INCREASING trend", trendText = "Significant DECREASING trend" ),
	trendText = "No significant monotonic trend"
);

// ---------------------------------------------------------------------
// STEP 6: Sen's slope, intercept, and confidence interval
//   CI follows the Gilbert (1987) rank-based approach (normal approx).
// ---------------------------------------------------------------------
sortedSlopes = Sort Ascending( slopes );
senSlope = Median( slopes );
senIntercept = Median( y - senSlope * x );

cAlpha = zCrit * Sqrt( varS );
m1 = (nSlopes - cAlpha) / 2;
m2 = (nSlopes + cAlpha) / 2;
loIdx = Max( 1, Min( nSlopes, Round( m1 ) ) );
hiIdx = Max( 1, Min( nSlopes, Round( m2 + 1 ) ) );
senLower = sortedSlopes[loIdx];
senUpper = sortedSlopes[hiIdx];

// ---------------------------------------------------------------------
// STEP 7: Assemble labels/values for the test-statistic table + log
// ---------------------------------------------------------------------
ciPct = Round( 100 * (1 - alpha), 1 );
statLabels = {"Response", "Time / order variable", "n (non-missing)", "S", "Var(S) (tie-corrected)", "Z (continuity corrected)",
"p-value (two-sided)", "Kendall tau (S / n(n-1)/2)", "Alpha", "Sen's slope (per unit time)",
"Sen's slope lower " || Char( ciPct ) || "% CI", "Sen's slope upper " || Char( ciPct ) || "% CI", "Sen's intercept"};
statValues = {yName, xName, Char( n ), Char( S ), Format( varS, "Best", 8 ), Format( Z, "Fixed Dec", 4 ),
Format( pValue, "Best", 6 ), Format( tau, "Fixed Dec", 4 ), Char( alpha ), Format( senSlope, "Best", 6 ),
Format( senLower, "Best", 6 ), Format( senUpper, "Best", 6 ), Format( senIntercept, "Best", 6 )};

Write(
	"\!NMann-Kendall: ", yName, " vs ", xName,
	"\!N  n = ", n, ", S = ", S, ", Z = ", Round( Z, 4 ), ", p = ", Round( pValue, 6 ),
	"\!N  Sen's slope = ", senSlope, " (", ciPct, "% CI: ", senLower, " to ", senUpper, ")",
	"\!N  ", trendText, "\!N"
);

// ---------------------------------------------------------------------
// STEP 8: Build (hidden) plot data table: time, observed value, Sen fit
//   Graph Builder needs a data table; it is closed with the report.
// ---------------------------------------------------------------------
dtPlot = New Table( "Mann-Kendall Plot Data: " || yName,
	Invisible,
	New Column( "Time", Numeric, Continuous, Set Values( x ) ),
	New Column( "Value", Numeric, Continuous, Set Values( y ) ),
	New Column( "Sen Fit", Numeric, Continuous, Set Values( senIntercept + senSlope * x ) )
);

// Color the conclusion by outcome (red = trend detected, green = none)
concColor = If( pValue &amp;lt; alpha, "Red", "Green" );

// ---------------------------------------------------------------------
// STEP 9: Build the custom output report window (Graph Builder + stats)
// ---------------------------------------------------------------------
win = New Window( "Mann-Kendall Trend Test: " || yName,
	V List Box(
		Text Box( "Mann-Kendall Trend Test with Sen's Slope", &amp;lt;&amp;lt; Set Font Size( 14 ), &amp;lt;&amp;lt; Set Font Style( "Bold" ) ),
		Text Box( "Response: " || yName || "   |   Time/Order: " || xName || "   |   n = " || Char( n ) ),
		Spacer Box( Size( 0, 8 ) ),
		// ----- Graph Builder: data points with Sen's slope line -----
		Outline Box( "Trend Plot",
			dtPlot &amp;lt;&amp;lt; Graph Builder(
				Size( 650, 400 ),
				Show Control Panel( 0 ),
				Variables( X( :Time ), Y( :Value ), Y( :Sen Fit, Position( 1 ) ) ),
				Elements( Points( X, Y( 1 ) ), Line( X, Y( 2 ) ) )
			)
		),
		// ----- Test statistics table -----
		Outline Box( "Test Statistics",
			Table Box(
				String Col Box( "Statistic", statLabels ),
				String Col Box( "Value", statValues )
			)
		),
		// ----- Conclusion -----
		Outline Box( "Conclusion",
			Text Box( trendText || " at alpha = " || Char( alpha ) || " (p = " || Format( pValue, "Best", 4 ) || ").",
				&amp;lt;&amp;lt; Set Font Style( "Bold" ), &amp;lt;&amp;lt; Font Color( concColor ) ),
			Text Box( "Sen's slope estimates the median change in " || yName || " per unit of " || xName || "." )
		),
		// ----- Notes -----
		Outline Box( "Notes",
			Text Box(
				"H0: no monotonic trend. Z uses a continuity correction and the tie-corrected variance of S.\!N"
				|| "Assumes independent observations; positive serial correlation inflates false positives.\!N"
				|| "Normal approximation is weak for n &amp;lt; 10." ),
			&amp;lt;&amp;lt; Close( 1 )
		),
		// ----- Optional export of statistics to a data table -----
		Button Box( "Save Statistics to Data Table",
			New Table( "Mann-Kendall Results: " || yName,
				New Column( "Statistic", Character, Nominal, Set Values( statLabels ) ),
				New Column( "Value", Character, Nominal, Set Values( statValues ) )
			)
		)
	)
);

// Close the hidden plot data table when the report window is closed
win &amp;lt;&amp;lt; On Close( Close( dtPlot, No Save ) );
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MathStatChem_0-1791393460993.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/119933iC7530AC1CB071E8E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MathStatChem_0-1791393460993.png" alt="MathStatChem_0-1791393460993.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Oct 2026 17:17:50 GMT</pubDate>
    <dc:creator>MathStatChem</dc:creator>
    <dc:date>2026-10-07T17:17:50Z</dc:date>
    <item>
      <title>Mann-Kendall Evaluation</title>
      <link>https://community.jmp.com/t5/Discussions/Mann-Kendall-Evaluation/m-p/970576#M110525</link>
      <description>&lt;P&gt;There is a Mann-Kendall Evaluation that can be done in ProUCL. Is there something equivalent (or close to equivalent) in JMP? I'd like to run an existing function/platform in JMP (no scripts).&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2026 19:24:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mann-Kendall-Evaluation/m-p/970576#M110525</guid>
      <dc:creator>FaceBiasBee678</dc:creator>
      <dc:date>2026-09-11T19:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Mann-Kendall Evaluation</title>
      <link>https://community.jmp.com/t5/Discussions/Mann-Kendall-Evaluation/m-p/971807#M110552</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/113156"&gt;@FaceBiasBee678&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;The Analyze &amp;gt; Multivariate platform has a&amp;nbsp;Kendall's τ option that might be what you're looking for. I'm not familiar with ProUCL, so I might be answering completely incorrectly.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jed_Campbell_0-1789595905040.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/117329i9DBC081EFEBB8192/image-size/large?v=v2&amp;amp;px=999" role="button" title="Jed_Campbell_0-1789595905040.png" alt="Jed_Campbell_0-1789595905040.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;When you mention looking for something equivalent or close to equivalent, can you clarify what exactly you're looking for? For example, do you need a non-parametric test for correlation between variables (Kendall's τ might be what you're looking for), or are you just looking to see if there's correlation between 2 variables (Fit Y by X &amp;gt; Fit Line might better suit your needs)?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2026 22:01:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mann-Kendall-Evaluation/m-p/971807#M110552</guid>
      <dc:creator>Jed_Campbell</dc:creator>
      <dc:date>2026-09-16T22:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Mann-Kendall Evaluation</title>
      <link>https://community.jmp.com/t5/Discussions/Mann-Kendall-Evaluation/m-p/972047#M110561</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/610"&gt;@Jed_Campbell&lt;/a&gt;&amp;nbsp;: The Mann-Kendall test is a test used on time series data to determine if within a sequence of points there exists a trend up or down...Kendall Tau is not what this poster is looking for. Maybe there is some type of test for this in Time Series platform?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2026 17:32:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mann-Kendall-Evaluation/m-p/972047#M110561</guid>
      <dc:creator>P_Bartell</dc:creator>
      <dc:date>2026-09-17T17:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Mann-Kendall Evaluation</title>
      <link>https://community.jmp.com/t5/Discussions/Mann-Kendall-Evaluation/m-p/975381#M110647</link>
      <description>&lt;P&gt;Apparently "&lt;SPAN data-markdown-start-index="3343"&gt;searching the &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-markdown-start-index="3426"&gt;JMP User Community&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN data-markdown-start-index="3446"&gt; for the &lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN data-markdown-start-index="3456"&gt;"Mann-Kendall Trend Test Add-In"&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN data-markdown-start-index="3489"&gt; will allow you to download a free script that generates the exact regulatory tables automatically." Has anyone done this and can provide the script along with some pointers?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2026 19:52:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mann-Kendall-Evaluation/m-p/975381#M110647</guid>
      <dc:creator>FaceBiasBee678</dc:creator>
      <dc:date>2026-10-06T19:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Mann-Kendall Evaluation</title>
      <link>https://community.jmp.com/t5/Discussions/Mann-Kendall-Evaluation/m-p/975581#M110651</link>
      <description>&lt;P&gt;A quick bit of "Claude"-ing comes up with this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// =====================================================================
// Mann-Kendall Trend Test + Sen's Slope (JSL)
// ---------------------------------------------------------------------
// Code created by Claude (Anthropic).
// Prompt summary: User asked for a JSL script that performs the
// Mann-Kendall test for monotonic trend in a time series (S statistic,
// tie-corrected variance, Z, p-value, Kendall's tau) plus Sen's slope
// with a confidence interval.
////
// Usage: open a data table, run this script, pick the response column
// (required), an optional time/order column, and alpha.
// =====================================================================

Names Default To Here( 1 );

// ---------------------------------------------------------------------
// Helper: Sign( v ) returns +1 if v &amp;gt; 0, -1 if v &amp;lt; 0, and 0 if v == 0
// ---------------------------------------------------------------------
Sign = Function( {v},
	If( v &amp;gt; 0, 1, v &amp;lt; 0, -1, 0 )
);

// ---------------------------------------------------------------------
// STEP 1: Select data table and columns
// ---------------------------------------------------------------------
dt = Current Data Table();
If( Is Empty( dt ),
	Throw( "Open a data table before running this script." )
);

dlg = Column Dialog(
	yCol = ColList( "Y, Response", Max Col( 1 ), Min Col( 1 ), Data Type( Numeric ) ),
	xCol = ColList( "Time / Order (optional; row order used if blank)", Max Col( 1 ) ),
	HList( "Alpha", alphaBox = EditNumber( 0.05 ) )
);
If( dlg["Button"] == -1, Throw( "Cancelled." ) );

yCol = dlg["yCol"];
xCol = dlg["xCol"];
alpha = dlg["alphaBox"];

yName = Column( dt, yCol[1] ) &amp;lt;&amp;lt; Get Name;
hasX = N Items( xCol ) &amp;gt; 0;
If( hasX, xName = Column( dt, xCol[1] ) &amp;lt;&amp;lt; Get Name, xName = "Observation Order" );

// ---------------------------------------------------------------------
// STEP 2: Pull values, drop missing, and sort by time/order
// ---------------------------------------------------------------------
yAll = Column( dt, yName ) &amp;lt;&amp;lt; Get Values;
nAll = N Rows( yAll );
If( hasX,
	xAll = Column( dt, xName ) &amp;lt;&amp;lt; Get Values,
	xAll = 1 :: nAll // row order as time index
);

keep = {};
For( i = 1, i &amp;lt;= nAll, i++,
	If( !Is Missing( yAll[i] ) &amp;amp; !Is Missing( xAll[i] ),
		Insert Into( keep, i )
	)
);
n = N Items( keep );
If( n &amp;lt; 4, Throw( "Need at least 4 non-missing observations." ) );

y = J( n, 1, . );
x = J( n, 1, . );
For( i = 1, i &amp;lt;= n, i++,
	y[i] = yAll[keep[i]];
	x[i] = xAll[keep[i]];
);

ord = Rank( x ); // indices that sort x ascending
y = y[ord];
x = x[ord];

// ---------------------------------------------------------------------
// STEP 3: Mann-Kendall S statistic and Sen's pairwise slopes
// ---------------------------------------------------------------------
nPairs = n * (n - 1) / 2;
slopes = J( nPairs, 1, . );
S = 0;
k = 0;
For( i = 1, i &amp;lt; n, i++,
	For( j = i + 1, j &amp;lt;= n, j++,
		S += Sign( y[j] - y[i] ); // +1 up, -1 down, 0 tie
		If( x[j] != x[i], // skip pairs with identical time stamps
			k++;
			slopes[k] = (y[j] - y[i]) / (x[j] - x[i]);
		);
	)
);
slopes = slopes[1 :: k]; // trim unused preallocated slots
nSlopes = k;

// ---------------------------------------------------------------------
// STEP 4: Tie-corrected variance of S
// ---------------------------------------------------------------------
ySorted = Sort Ascending( y );
tieTerm = 0;
runLen = 1;
For( i = 2, i &amp;lt;= n + 1, i++,
	If( i &amp;lt;= n &amp;amp; ySorted[i] == ySorted[i - 1],
		runLen += 1, // still inside a tied group
		If( runLen &amp;gt; 1, tieTerm += runLen * (runLen - 1) * (2 * runLen + 5) );
		runLen = 1;
	)
);
varS = (n * (n - 1) * (2 * n + 5) - tieTerm) / 18;

// ---------------------------------------------------------------------
// STEP 5: Z statistic (continuity corrected), p-value, Kendall's tau
// ---------------------------------------------------------------------
If( S &amp;gt; 0,
	Z = (S - 1) / Sqrt( varS ),
	S &amp;lt; 0,
	Z = (S + 1) / Sqrt( varS ),
	Z = 0
);
pValue = 2 * (1 - Normal Distribution( Abs( Z ) ));
tau = S / nPairs; // simple tau (not tau-b); equals tau-b when no ties
zCrit = Normal Quantile( 1 - alpha / 2 );

If( pValue &amp;lt; alpha,
	If( Z &amp;gt; 0, trendText = "Significant INCREASING trend", trendText = "Significant DECREASING trend" ),
	trendText = "No significant monotonic trend"
);

// ---------------------------------------------------------------------
// STEP 6: Sen's slope, intercept, and confidence interval
//   CI follows the Gilbert (1987) rank-based approach (normal approx).
// ---------------------------------------------------------------------
sortedSlopes = Sort Ascending( slopes );
senSlope = Median( slopes );
senIntercept = Median( y - senSlope * x );

cAlpha = zCrit * Sqrt( varS );
m1 = (nSlopes - cAlpha) / 2;
m2 = (nSlopes + cAlpha) / 2;
loIdx = Max( 1, Min( nSlopes, Round( m1 ) ) );
hiIdx = Max( 1, Min( nSlopes, Round( m2 + 1 ) ) );
senLower = sortedSlopes[loIdx];
senUpper = sortedSlopes[hiIdx];

// ---------------------------------------------------------------------
// STEP 7: Assemble labels/values for the test-statistic table + log
// ---------------------------------------------------------------------
ciPct = Round( 100 * (1 - alpha), 1 );
statLabels = {"Response", "Time / order variable", "n (non-missing)", "S", "Var(S) (tie-corrected)", "Z (continuity corrected)",
"p-value (two-sided)", "Kendall tau (S / n(n-1)/2)", "Alpha", "Sen's slope (per unit time)",
"Sen's slope lower " || Char( ciPct ) || "% CI", "Sen's slope upper " || Char( ciPct ) || "% CI", "Sen's intercept"};
statValues = {yName, xName, Char( n ), Char( S ), Format( varS, "Best", 8 ), Format( Z, "Fixed Dec", 4 ),
Format( pValue, "Best", 6 ), Format( tau, "Fixed Dec", 4 ), Char( alpha ), Format( senSlope, "Best", 6 ),
Format( senLower, "Best", 6 ), Format( senUpper, "Best", 6 ), Format( senIntercept, "Best", 6 )};

Write(
	"\!NMann-Kendall: ", yName, " vs ", xName,
	"\!N  n = ", n, ", S = ", S, ", Z = ", Round( Z, 4 ), ", p = ", Round( pValue, 6 ),
	"\!N  Sen's slope = ", senSlope, " (", ciPct, "% CI: ", senLower, " to ", senUpper, ")",
	"\!N  ", trendText, "\!N"
);

// ---------------------------------------------------------------------
// STEP 8: Build (hidden) plot data table: time, observed value, Sen fit
//   Graph Builder needs a data table; it is closed with the report.
// ---------------------------------------------------------------------
dtPlot = New Table( "Mann-Kendall Plot Data: " || yName,
	Invisible,
	New Column( "Time", Numeric, Continuous, Set Values( x ) ),
	New Column( "Value", Numeric, Continuous, Set Values( y ) ),
	New Column( "Sen Fit", Numeric, Continuous, Set Values( senIntercept + senSlope * x ) )
);

// Color the conclusion by outcome (red = trend detected, green = none)
concColor = If( pValue &amp;lt; alpha, "Red", "Green" );

// ---------------------------------------------------------------------
// STEP 9: Build the custom output report window (Graph Builder + stats)
// ---------------------------------------------------------------------
win = New Window( "Mann-Kendall Trend Test: " || yName,
	V List Box(
		Text Box( "Mann-Kendall Trend Test with Sen's Slope", &amp;lt;&amp;lt; Set Font Size( 14 ), &amp;lt;&amp;lt; Set Font Style( "Bold" ) ),
		Text Box( "Response: " || yName || "   |   Time/Order: " || xName || "   |   n = " || Char( n ) ),
		Spacer Box( Size( 0, 8 ) ),
		// ----- Graph Builder: data points with Sen's slope line -----
		Outline Box( "Trend Plot",
			dtPlot &amp;lt;&amp;lt; Graph Builder(
				Size( 650, 400 ),
				Show Control Panel( 0 ),
				Variables( X( :Time ), Y( :Value ), Y( :Sen Fit, Position( 1 ) ) ),
				Elements( Points( X, Y( 1 ) ), Line( X, Y( 2 ) ) )
			)
		),
		// ----- Test statistics table -----
		Outline Box( "Test Statistics",
			Table Box(
				String Col Box( "Statistic", statLabels ),
				String Col Box( "Value", statValues )
			)
		),
		// ----- Conclusion -----
		Outline Box( "Conclusion",
			Text Box( trendText || " at alpha = " || Char( alpha ) || " (p = " || Format( pValue, "Best", 4 ) || ").",
				&amp;lt;&amp;lt; Set Font Style( "Bold" ), &amp;lt;&amp;lt; Font Color( concColor ) ),
			Text Box( "Sen's slope estimates the median change in " || yName || " per unit of " || xName || "." )
		),
		// ----- Notes -----
		Outline Box( "Notes",
			Text Box(
				"H0: no monotonic trend. Z uses a continuity correction and the tie-corrected variance of S.\!N"
				|| "Assumes independent observations; positive serial correlation inflates false positives.\!N"
				|| "Normal approximation is weak for n &amp;lt; 10." ),
			&amp;lt;&amp;lt; Close( 1 )
		),
		// ----- Optional export of statistics to a data table -----
		Button Box( "Save Statistics to Data Table",
			New Table( "Mann-Kendall Results: " || yName,
				New Column( "Statistic", Character, Nominal, Set Values( statLabels ) ),
				New Column( "Value", Character, Nominal, Set Values( statValues ) )
			)
		)
	)
);

// Close the hidden plot data table when the report window is closed
win &amp;lt;&amp;lt; On Close( Close( dtPlot, No Save ) );
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MathStatChem_0-1791393460993.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/119933iC7530AC1CB071E8E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MathStatChem_0-1791393460993.png" alt="MathStatChem_0-1791393460993.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2026 17:17:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mann-Kendall-Evaluation/m-p/975581#M110651</guid>
      <dc:creator>MathStatChem</dc:creator>
      <dc:date>2026-10-07T17:17:50Z</dc:date>
    </item>
  </channel>
</rss>

