<?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: Script for standard deviation based on +/- 1.5 sigma in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49580#M28201</link>
    <description>&lt;P&gt;Thanks Dave.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jan 2018 00:14:29 GMT</pubDate>
    <dc:creator>AT</dc:creator>
    <dc:date>2018-01-12T00:14:29Z</dc:date>
    <item>
      <title>Script for standard deviation based on +/- 1.5 sigma</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49333#M28041</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I like to calculate standard deviation based on looking at data with ranges of values (+/- 1.5 sigma). Is there anyone you can achiev that in JMP?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your help. Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 22:11:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49333#M28041</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-01-05T22:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script for standard deviation based on +/- 1.5 sigma</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49334#M28042</link>
      <description>&lt;P&gt;is this what you want&amp;gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

sigma = Col Std Dev( :npn1 );
special std dev = Col Std Dev( If( (Col Mean( :npn1 ) - 1.5*sigma) &amp;lt;= :npn1 | :npn1 &amp;gt;= (Col Mean( :npn1 ) + 1.5*sigma), ., :npn1 ) );
Show( sigma, special std dev );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Jan 2018 22:36:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49334#M28042</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-01-05T22:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script for standard deviation based on +/- 1.5 sigma</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49335#M28043</link>
      <description>&lt;P&gt;Thanks Jim for quick feedback and solution. This what I want. I lalso&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;is this what you want&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

sigma = Col Std Dev( :npn1 );
special std dev = Col Std Dev( If( (Col Mean( :npn1 ) - 1.5*sigma) &amp;lt;= :npn1 | :npn1 &amp;gt;= (Col Mean( :npn1 ) + 1.5*sigma), ., :npn1 ) );
Show( sigma, special std dev );&lt;/CODE&gt;&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;ike to do this for many columns in a data table and then create a new colum with Pass or Fail values. I supose the spec limits for each column can be read from a data table and then new column with "Pass" or Fail" based on control limits.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone has done this type of work, I will be intersted to learn from that. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 22:58:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49335#M28043</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-01-05T22:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Script for standard deviation based on +/- 1.5 sigma</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49575#M28196</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;I followed your script and added list of columns to calculate this special sigma. When I run the script, I get&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;sigma = .;&lt;/P&gt;&lt;P class="p1"&gt;special std dev = .;&lt;/P&gt;&lt;P class="p1"&gt;sigma = .;&lt;/P&gt;&lt;P class="p1"&gt;special std dev = .;&lt;/P&gt;&lt;P class="p1"&gt;sigma = .;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;Here is the script:&lt;/P&gt;&lt;P class="p1"&gt;Names Default To Here&lt;SPAN class="s1"&gt;( &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;1&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; );&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN class="s1"&gt;dt = &lt;/SPAN&gt;&lt;SPAN class="s3"&gt;Open&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;( &lt;/SPAN&gt;"$SAMPLE_DATA/semiconductor capability.jmp"&lt;SPAN class="s1"&gt; );&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;Current data Table&lt;SPAN class="s1"&gt;();&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p4"&gt;lstNames = dt &amp;lt;&amp;lt; &lt;SPAN class="s4"&gt;Get Column Names&lt;/SPAN&gt;(String,Numeric);&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN class="s3"&gt;for&lt;/SPAN&gt; (i =&lt;SPAN class="s2"&gt;1&lt;/SPAN&gt;, i &amp;lt;= &lt;SPAN class="s3"&gt;N Items&lt;/SPAN&gt; (lstNames), i++,&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN class="s3"&gt;if&lt;/SPAN&gt; (&lt;SPAN class="s3"&gt;contains&lt;/SPAN&gt;(lstNames[i],&lt;SPAN class="s5"&gt;"NP"&lt;/SPAN&gt;) == &lt;SPAN class="s2"&gt;1&lt;/SPAN&gt;,&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p4"&gt;sigma = &lt;SPAN class="s3"&gt;Col Std Dev&lt;/SPAN&gt;( lstNames[i]);&lt;/P&gt;&lt;P class="p4"&gt;special std dev = &lt;SPAN class="s3"&gt;Col Std Dev&lt;/SPAN&gt;( &lt;SPAN class="s3"&gt;If&lt;/SPAN&gt;( (&lt;SPAN class="s3"&gt;Col Mean&lt;/SPAN&gt;( lstNames[i] ) - &lt;SPAN class="s2"&gt;1.5&lt;/SPAN&gt;*sigma) &amp;lt;= lstNames[i] | lstNames[i] &amp;gt;= (&lt;SPAN class="s3"&gt;Col Mean&lt;/SPAN&gt;( lstNames[i] ) + &lt;SPAN class="s2"&gt;1.5&lt;/SPAN&gt;*sigma),&lt;SPAN class="s2"&gt;.&lt;/SPAN&gt;,lstNames[i] ) );&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN class="s3"&gt;Show&lt;/SPAN&gt;( sigma, special std dev );&lt;/P&gt;&lt;P class="p4"&gt;)&lt;/P&gt;&lt;P class="p4"&gt;);&lt;/P&gt;&lt;P class="p4"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p4"&gt;I appreciate your help. Thanks&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/10363"&gt;@AT&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Thanks Jim for quick feedback and solution. This what I want. I lalso&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;is this what you want&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

sigma = Col Std Dev( :npn1 );
special std dev = Col Std Dev( If( (Col Mean( :npn1 ) - 1.5*sigma) &amp;lt;= :npn1 | :npn1 &amp;gt;= (Col Mean( :npn1 ) + 1.5*sigma), ., :npn1 ) );
Show( sigma, special std dev );&lt;/CODE&gt;&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;ike to do this for many columns in a data table and then create a new colum with Pass or Fail values. I supose the spec limits for each column can be read from a data table and then new column with "Pass" or Fail" based on control limits.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone has done this type of work, I will be intersted to learn from that. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P class="p4"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 22:16:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49575#M28196</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-01-11T22:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Script for standard deviation based on +/- 1.5 sigma</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49576#M28197</link>
      <description>&lt;P&gt;The argument to Col Std Dev needs to be a column reference not the string name.&amp;nbsp; You can use the Column function to generate a column reference from the string name:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;sigma = Col Std Dev( Column( lstNames[i]) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jan 2018 22:27:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49576#M28197</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2018-01-11T22:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Script for standard deviation based on +/- 1.5 sigma</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49578#M28199</link>
      <description>&lt;P&gt;The issue you are running into is that you were placing into the formula not a column name, like NPN1, but rather a literal string of "NPN".&amp;nbsp; The Substitute function allows one to take the "NPN1" and substitute in :NPN1.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
Current Data Table();

lstNames = dt &amp;lt;&amp;lt; Get Column Names( string, Numeric );

For( i = 1, i &amp;lt;= N Items( lstNames ), i++,
	If( Contains( lstNames[i], "NP" ) == 1,
		sigma = Col Std Dev( Column( dt, lstNames[i] ) );
		Eval(
			Substitute(
					Expr(
						special std dev = Col Std Dev(
							If( (Col Mean( __col__ ) - 1.5 * sigma) &amp;lt;= __col__ | __col__ &amp;gt;= (Col Mean( __col__ ) + 1.5 * sigma),
								.,
								__col__
							)
						)
					),
				Expr( __col__ ), Parse( ":" || lstNames[i] )
			)
		);
		Show( sigma, special std dev );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And here is another way to specify that the literal string is to be treated as a column name&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
Current Data Table();

lstNames = dt &amp;lt;&amp;lt; Get Column Names( string, Numeric );

For( i = 1, i &amp;lt;= N Items( lstNames ), i++,
	If( Contains( lstNames[i], "NP" ) == 1,
		sigma = Col Std Dev( Column( dt, lstNames[i] ) );
		
		special std dev = Col Std Dev(
			If(
				(Col Mean( As Column( lstNames[i] ) ) - 1.5 * sigma) &amp;lt;= As Column( lstNames[i] ) | As Column( lstNames[i] ) &amp;gt;= (
				Col Mean( As Column( lstNames[i] ) ) + 1.5 * sigma),
				.,
				As Column( lstNames[i] )
			)
		);
	);
	Show( sigma, special std dev );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jan 2018 22:43:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49578#M28199</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-01-11T22:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: Script for standard deviation based on +/- 1.5 sigma</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49580#M28201</link>
      <description>&lt;P&gt;Thanks Dave.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 00:14:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49580#M28201</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-01-12T00:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Script for standard deviation based on +/- 1.5 sigma</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49581#M28202</link>
      <description>&lt;P&gt;Thanks Jim. It is very helpful.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 00:19:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-standard-deviation-based-on-1-5-sigma/m-p/49581#M28202</guid>
      <dc:creator>AT</dc:creator>
      <dc:date>2018-01-12T00:19:53Z</dc:date>
    </item>
  </channel>
</rss>

