<?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 Sub-Sample randomly from a column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/561461#M77452</link>
    <description>&lt;P&gt;Hello all, - I have a population of 200 stores across the country.&amp;nbsp; I'm interested to know if I can sub-sample a fraction of these stores and approximate the distribution of events. Might there be some Monte Carlo method for filling e.g., 30 rows in a new column with a random sub-sample from the original 200.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I could compare the distribution of the 30 counts in the sub-sample to the distribution in the population of 200.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Repeat this say 100 times to determine the risk of sampling 30 stores to represent the population of 200.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thoughts?&amp;nbsp; thanks, Paul&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First 10 rows of the 200&lt;/P&gt;&lt;P&gt;Store# - column 1&lt;/P&gt;&lt;P&gt;Even count - column 2&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;19&lt;BR /&gt;20&lt;BR /&gt;21&lt;BR /&gt;22&lt;BR /&gt;23&lt;BR /&gt;25&lt;BR /&gt;26&lt;BR /&gt;27&lt;BR /&gt;29&lt;BR /&gt;34&lt;/TD&gt;&lt;TD&gt;1&lt;BR /&gt;4&lt;BR /&gt;7&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;3&lt;BR /&gt;12&lt;BR /&gt;5&lt;BR /&gt;8&lt;BR /&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:56:00 GMT</pubDate>
    <dc:creator>paulp</dc:creator>
    <dc:date>2023-06-10T23:56:00Z</dc:date>
    <item>
      <title>Sub-Sample randomly from a column</title>
      <link>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/561461#M77452</link>
      <description>&lt;P&gt;Hello all, - I have a population of 200 stores across the country.&amp;nbsp; I'm interested to know if I can sub-sample a fraction of these stores and approximate the distribution of events. Might there be some Monte Carlo method for filling e.g., 30 rows in a new column with a random sub-sample from the original 200.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I could compare the distribution of the 30 counts in the sub-sample to the distribution in the population of 200.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Repeat this say 100 times to determine the risk of sampling 30 stores to represent the population of 200.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thoughts?&amp;nbsp; thanks, Paul&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First 10 rows of the 200&lt;/P&gt;&lt;P&gt;Store# - column 1&lt;/P&gt;&lt;P&gt;Even count - column 2&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;19&lt;BR /&gt;20&lt;BR /&gt;21&lt;BR /&gt;22&lt;BR /&gt;23&lt;BR /&gt;25&lt;BR /&gt;26&lt;BR /&gt;27&lt;BR /&gt;29&lt;BR /&gt;34&lt;/TD&gt;&lt;TD&gt;1&lt;BR /&gt;4&lt;BR /&gt;7&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;3&lt;BR /&gt;12&lt;BR /&gt;5&lt;BR /&gt;8&lt;BR /&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:56:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/561461#M77452</guid>
      <dc:creator>paulp</dc:creator>
      <dc:date>2023-06-10T23:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Sample randomly from a column</title>
      <link>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/561468#M77454</link>
      <description>&lt;P&gt;Take a look at the &lt;A href="https://www.jmp.com/support/help/en/16.2/index.shtml#page/jmp/random-functions.shtml#ww132346" target="_blank" rel="noopener"&gt;Resample Freq()&lt;/A&gt; function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;H4 id="ww132346" class="HeadMinor"&gt;Resample Freq&lt;/H4&gt;
&lt;P class="body"&gt;Generates a random selection with replacement frequency counts, suitable for use in bootstrapping. For example, it supports a second &lt;SPAN class="command"&gt;Freq Column&lt;/SPAN&gt; argument, enabling it to do bootstrap samples relating to a pre-existing frequency column specified in the second argument. &lt;SPAN class="code"&gt;Resample Freq()&lt;/SPAN&gt; generates a 100% resample. &lt;SPAN class="code"&gt;ResampleFreq(rate)&lt;/SPAN&gt; generates a &lt;SPAN class="code"&gt;rate&lt;/SPAN&gt; frequency sample. &lt;SPAN class="code"&gt;Resample(rate, column)&lt;/SPAN&gt; generates a sample that is calculated by the rate multiplied by the sum of the specified column. For more information about the syntax for the Resample Freq function, see &lt;A title="Discrete Probability Functions" href="https://www.jmp.com/support/help/en/16.2/jmp/discrete-probability-functions.shtml#ww114883" target="_blank"&gt;Discrete Probability Functions&lt;/A&gt; in the &lt;SPAN class="BookTitle"&gt;JSL Syntax Reference&lt;/SPAN&gt;.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 27 Oct 2022 22:44:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/561468#M77454</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2022-10-27T22:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Sample randomly from a column</title>
      <link>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/562035#M77505</link>
      <description>&lt;P&gt;Hello Jeff, thank you for the reply.&amp;nbsp; I am not understanding how to use the function for my purpose, unfortunately.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Resample Freq creates counts of re-samples.&amp;nbsp; This seems it would be an intermediate step to then creating a new table with the sub-sampled data. I am hoping to directly create a column of sub-sampled data from the original population of 200 rows.&lt;/LI&gt;&lt;LI&gt;I would prefer to sample without replacement, not bootstrap.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If I only needed the original data sub-sampled once, the easiest path would be Table &amp;gt; Subset &amp;gt; Random Sample Size = 30 (e.g.)&lt;/P&gt;&lt;P&gt;I don't script, otherwise I would create a loop to produce 100 tables of 30 random samples, then concatenate the 100 tables into a master table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to directly grab 30 random samples from a column, and put those 30 values into a new column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ultimately, I hope to try the Reliability &amp;gt; Life distribution &amp;gt; Compare Groups to assess the distribution of the subsamples vs. original population distribution.&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Then repeat for Sample Size = 20, then 40, etc. so I can assess the minimum sample size that gives a similar distribution to the population of 200 stores.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks, Paul&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 18:58:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/562035#M77505</guid>
      <dc:creator>paulp</dc:creator>
      <dc:date>2022-10-28T18:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Sample randomly from a column</title>
      <link>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/562046#M77506</link>
      <description>&lt;P&gt;I quick way to do a subsample using a column formula is the use the Col Shuffle() function.&amp;nbsp; The function returns a random reordering of row numbers.&amp;nbsp; If you choose rows where the values of Col Shuffle() are less than than or equal to the subsample size (n_sub), this equivalent to doing a random ordering of the column and selecting the first n_sub rows.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, adding new column with this formula will do this for a subsample size of 30.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SamGardner_0-1666984984603.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/46723i0B36704DEDB11ECE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SamGardner_0-1666984984603.png" alt="SamGardner_0-1666984984603.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;example table attached.&lt;/P&gt;
&lt;P&gt;If you want to do this repeatedly, then learning some JMP Scripting would make this easier.&amp;nbsp; A basic script to add columns like this repeatedly is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

Number_of_Cols_to_Add = 100;

For( i = 1, i &amp;lt;= Number_of_Cols_to_Add, i++, 
	
	Current Data Table() &amp;lt;&amp;lt; 
	New Column( "Y Subsample (Size 30)",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( If( Col Shuffle() &amp;lt;= 30, :Y, . ) )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 19:31:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/562046#M77506</guid>
      <dc:creator>SamGardner</dc:creator>
      <dc:date>2022-10-28T19:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Sample randomly from a column</title>
      <link>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/562068#M77507</link>
      <description>&lt;P&gt;Here is an example script that creates subsets of a given size without replacement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

// New formula column: Row
Data Table( "semiconductor capability" ) &amp;lt;&amp;lt; New Column( "Row",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula( Row() )
) &amp;lt;&amp;lt; Move Selected Columns( {:Row}, after( :SITE ) );

// Loop through data creating sample data tables
sampleSize = 20;

For( i = 1, i &amp;lt;= 20, i++,
	dtSample = Data Table( "semiconductor capability" ) &amp;lt;&amp;lt; Subset(
		Sample Size( sampleSize ),
		Selected columns only( 0 ),
		output table( "Sample " || Char( i ) )
	);
	
	matSelected = dtSample:Row &amp;lt;&amp;lt; get values;
	
	// Delete row column from sample data
	dtSample &amp;lt;&amp;lt; delete columns( Row );

// Delete selected rows from main table
	dt &amp;lt;&amp;lt; select rows( matSelected );
	dt &amp;lt;&amp;lt; delete rows;
);

// Delete row column from original data table
dt &amp;lt;&amp;lt; delete columns( Row );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Oct 2022 19:59:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/562068#M77507</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-10-28T19:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Sample randomly from a column</title>
      <link>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/562154#M77520</link>
      <description>&lt;P&gt;I understand that you are not scripting your solution. You can also interactively use Tables &amp;gt; Subset to create a new smaller table with randomly selected rows from the original data table. Would that way work for you?&lt;/P&gt;</description>
      <pubDate>Sat, 29 Oct 2022 15:05:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/562154#M77520</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2022-10-29T15:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Sample randomly from a column</title>
      <link>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/563114#M77621</link>
      <description>&lt;P&gt;&amp;nbsp; Thank you, Sam, and to&amp;nbsp;everyone who posted solutions.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 22:06:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/563114#M77621</guid>
      <dc:creator>paulp</dc:creator>
      <dc:date>2022-11-01T22:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Sample randomly from a column</title>
      <link>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/563245#M77626</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6066"&gt;@paulp&lt;/a&gt; ,&lt;BR /&gt;the other non-scripting solution that can be useful in such applications is using JMP query builder under the Tables menu.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ron_horne_1-1667380578796.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/46821i0E19FAEC255AFFA7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ron_horne_1-1667380578796.png" alt="ron_horne_1-1667380578796.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;there you can find a random sampling tab as in the picture&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="ron_horne_0-1667380494559.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/46819i3BD8066FE4D3E151/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ron_horne_0-1667380494559.png" alt="ron_horne_0-1667380494559.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As usual one you run it interactively you can make use of the script created for additional usage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 09:19:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/563245#M77626</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2022-11-02T09:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Sample randomly from a column</title>
      <link>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/564924#M77711</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks, Ron&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 16:14:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sub-Sample-randomly-from-a-column/m-p/564924#M77711</guid>
      <dc:creator>paulp</dc:creator>
      <dc:date>2022-11-04T16:14:00Z</dc:date>
    </item>
  </channel>
</rss>

