<?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: Random subset selection for a given distribution in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79388#M36690</link>
    <description>&lt;P&gt;Jeff,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your effort.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your suggestion had a slight chance. I applied it to my data and unfortunately since the selection is random, it did not work. I ran it for about 3000 iterations and stopped it after 10 hours. The movement on the mean of data was insignifcant.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This isn't a simple technique (unless your name is Ian) .. I would imagine some sort of optimizer being involved trying to random pull from the direction that it makes more sense. GA's may be an overkill but certainly can do this kind of optimization.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From statistical perspective, this is perfectly ok for what I do. The 400+K represents a big data of assets.. I am trying to find assets that are similar to a sub-group under investigation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks again.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Oct 2018 17:12:13 GMT</pubDate>
    <dc:creator>altug_bayram</dc:creator>
    <dc:date>2018-10-17T17:12:13Z</dc:date>
    <item>
      <title>Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78958#M36630</link>
      <description>&lt;P&gt;Hello ...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to randomly select from a column of data for a given normal distribution . The given distribution is different than that of the data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an easy way of accomplishing this with Table Subset's current options ? I could not see anything that could help me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried a formula, basically NormalDensity (X, mu, sigma) to plot the densities of the "data" against the given distribution.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I still don't know how to say uniformly &amp;amp; randomly select from this formula so my outcome is as close as possible to the given distribution.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx. Appreciate the support.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 19:33:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78958#M36630</guid>
      <dc:creator>altug_bayram</dc:creator>
      <dc:date>2018-10-15T19:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78959#M36631</link>
      <description>&lt;P&gt;Once you have your population column from which you want to sample, try out, this workflow:&lt;/P&gt;
&lt;P&gt;1. Select the column from which you want to sample.&lt;/P&gt;
&lt;P&gt;2. From the JMP main menu bar, select Rows -&amp;gt; Row Selection -&amp;gt; Select Randomly -&amp;gt; and then your sample size or sampling rate.&lt;/P&gt;
&lt;P&gt;This will return selected columns in your original data table, and from there Row Subset will give you a data table.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 19:44:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78959#M36631</guid>
      <dc:creator>Peter_Bartell</dc:creator>
      <dc:date>2018-10-15T19:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78960#M36632</link>
      <description>Peter .. thanks for your suggestion.&lt;BR /&gt;but that does not seem to work.&lt;BR /&gt;&lt;BR /&gt;My original data's mean/stdev are: 12816 and 1726 from a very large sample (400K +).&lt;BR /&gt;I am trying to downselect a sub-sample that is closer to 14300 and 2050&lt;BR /&gt;&lt;BR /&gt;I tried your suggestion on the formula (i.e. densities of the data wrt 14300, 2050) and unless I can force this random dist to be uniformly selected among the densities, I don't think I can get what I need. In fact, sub-sampling came out as expected w/ the original distribution.</description>
      <pubDate>Mon, 15 Oct 2018 19:57:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78960#M36632</guid>
      <dc:creator>altug_bayram</dc:creator>
      <dc:date>2018-10-15T19:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78961#M36633</link>
      <description>&lt;P&gt;I see...I did not fully understand your original post. Your right my suggestion will just return a distribution with very similar parameters to the original distribution. If you want observations of a random variable with the desired parameter estimates, why can't you just create a column with those parameters and move on. Sure, the specific observations won't necessarily reside in the original column, but that may or may not influence what you're trying to acheive analytically or practically? They'll at least be plausible observations,&amp;nbsp;though not exact matches.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 20:22:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78961#M36633</guid>
      <dc:creator>Peter_Bartell</dc:creator>
      <dc:date>2018-10-15T20:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78965#M36635</link>
      <description>My real goal is to compare N (other) parameters from two data sets already available, I am not trying to create a fictitious distribution. (Maybe I am misunderstanding your proposal).&lt;BR /&gt;&lt;BR /&gt;The given distribution is a constraint on an important parameter that may influences others. I am trying to select assets w/ similar distribution from "data" to a given distribution so to minimize the impact of this influential parameter. In this context, "distribution" only applies for a single parameter, and not multiple.&lt;BR /&gt;&lt;BR /&gt;So bottom line, I need to sub-select from 400K+ rows a number of sub-samples so that the distribution for the selected sub-sample is as close as possible to the given distribution.</description>
      <pubDate>Mon, 15 Oct 2018 20:44:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78965#M36635</guid>
      <dc:creator>altug_bayram</dc:creator>
      <dc:date>2018-10-15T20:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78977#M36637</link>
      <description>&lt;P&gt;I believe that you can get what you want by doing a simple 2 step process.&lt;/P&gt;
&lt;P&gt;1. Open the Distribution Platform for the column you have in question.&amp;nbsp; Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Save==&amp;gt;Level Numbers.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will create a new column with a distribution taken directly from the actual data&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp; Create a subset of the data and specify&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Random - sampling rate:&lt;/P&gt;
&lt;P&gt;and also&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Stratify, based upon the new Level column created in the step above&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 21:04:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78977#M36637</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-10-15T21:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78982#M36640</link>
      <description>&lt;P&gt;Jim, thanks for your suggestion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But your proposal does not have a way to force select according for the given distribution. So it wouldn't produce what I am looking for. To validate, I did follow the steps and it produced a dist very similar to the original one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe I am not explaning in a clear way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 400k+ rows X N columns of data (huge matrix) . If I call one of N params, as "X" for argument sake.&amp;nbsp;&lt;/P&gt;&lt;P&gt;X's distribution from this data - call it X.dist1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a second dataset which has Xagain, and this time w/ X.dist2&amp;nbsp;&lt;/P&gt;&lt;P&gt;X.dist1 is not too far but is different than X.dist2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given the fact that I have plenty of data in the first dataset (400k+), I am hence trying to sub-select data set from 1 so that selected data X distribution is the closest I can get to X.dist2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hence I was looking for some capabiltiy under Table - Subset where I can specify normal distribution characteristic OR using a formula and then using Table- subset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for the formula, I put densities of dataset1 against my desired X.dist2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But now I need a&amp;nbsp; uniform random way of sampling from the formulae outputs so to force the outcome distribution to be ~ X.dist2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OR any any other way ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I am to use a Table-Subset - the solution needs to specify a normal distribution from a parameter to pull from.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or otherwise, I need to find a uniform random selection from a parameter (formula approach).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 22:15:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78982#M36640</guid>
      <dc:creator>altug_bayram</dc:creator>
      <dc:date>2018-10-15T22:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78983#M36641</link>
      <description>&lt;P&gt;I am just free thinking here, but maybe what you could try, is to determine the distribution shape, using the Distribution Platform, then transform the data to a normal distribution.&amp;nbsp; Then do the outputing of the Levels and then the subsetting with stratification.&amp;nbsp; Just a thought.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 23:56:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/78983#M36641</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-10-15T23:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79292#M36668</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-right" image-alt="Oct-16-2018 17-53-15.gif" style="width: 287px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12831i25CE43D4A67453F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Oct-16-2018 17-53-15.gif" alt="Oct-16-2018 17-53-15.gif" /&gt;&lt;/span&gt;Depending on your purpose getting a subset like this may be statistically questionable but one way to do it is to brute force it by using&amp;nbsp;Resample Freq() to generate random samples and then checking that sample to see if it meets your desired characteristics. Here's a prototype that generates a table to simulate your original data and then resamples it, uses the Distribution platform to test the sample.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "original",
	Add Rows( 1000 ), 
	//:parameter will have a random normal distribution with mean=0
	//and a stddev=1
	New Column( "parameter",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Random Normal() )
	),
	New Column( "Row", Numeric, "Continuous", Format( "Best", 12 ), Formula( Row() ) ), 
	//The Resample Freq() function generates a frequence count for sample with replacement
	//the .05 argument is the sample rate, i.e. we want a sample size of 5% of the original table
	New Column( "Resample Freq",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Resample Freq( 0.05 ) ), 

	)
);

//Generate a distribution of :parameter using the resample frequency as a Freq column to get
//Automatic Recalc will cause the Distribution to rerun when the Resample Freq column is re-evaluated
//to get a new sample
New Window( "Dist comparison",
	H List Box(
		dt &amp;lt;&amp;lt; Distribution( Continuous Distribution( Column( :parameter ) ) ), 	

		dist = dt &amp;lt;&amp;lt; Distribution(
			Automatic Recalc( 1 ),
			Freq( :Resample Freq ),
			Continuous Distribution( Column( :parameter ) )
		)
	)
);


//set the minimum mean value we will accept for the subsample
target_mean_min = .249;

//set the minimum mean value we will accept for the subsample
target_mean_max = .251;

//how many iterations are we willing to try before giving up?
max_iter = 1000;

iter = 1;

While( 
	//Report( dist )[Number Col Box( 2 )][1] is the mean value from the Distribution report
	!(target_mean_min &amp;lt;= Report( dist )[Number Col Box( 2 )][1] &amp;lt;= target_mean_max) &amp;amp;
	iter &amp;lt;= max_iter, 
	//get a new sample 
	Column( "Resample Freq" ) &amp;lt;&amp;lt; eval formula;
	iter++;
);

If( 
	//check to see if we exited because we hit max_iter or got a good sample 
	iter &amp;gt; max_iter &amp;amp; !(target_mean_min &amp;lt;= Report( dist )[Number Col Box( 2 )][1] &amp;lt;=
	target_mean_max)
,
	Print( "No result in " || Char( max_iter ) || " random samples." ), 
	//got a good sample so get the subset
	dt &amp;lt;&amp;lt; select where( :resample freq != 0 );
	dt &amp;lt;&amp;lt; Subset( Selected Rows( 1 ), Selected columns only( 0 ) );
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 21:54:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79292#M36668</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2018-10-16T21:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79315#M36670</link>
      <description>&lt;P&gt;If "&lt;SPAN&gt;So bottom line, I need to sub-select from 400K+ rows a number of sub-samples so that the distribution for the selected sub-sample is as close as possible to the given distribution&lt;/SPAN&gt;" is what you want, maybe you could use this kind of approach, or something close to it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

// Make a big table
dt1 = NewTable("Big", NewColumn("Values", Numeric, Continuous, Formula(RandomUniform(-3,3))));
dt1 &amp;lt;&amp;lt; addRows(40000);
dt1 &amp;lt;&amp;lt; runFormulas;
Column(dt1, "Values") &amp;lt;&amp;lt; deleteFormula;

// Make a small table
dt2 = NewTable("Small", NewColumn("Values", Numeric, Continuous, Formula(RandomNormal(0,1))));
dt2 &amp;lt;&amp;lt; addRows(40);
dt2 &amp;lt;&amp;lt; runFormulas;
Column(dt2, "Values") &amp;lt;&amp;lt; deleteFormula;

// For each value in dt2, find a value in dt1 that's closest
bv = Column(dt1, "Values") &amp;lt;&amp;lt; getValues;
sv = Column(dt2, "Values") &amp;lt;&amp;lt; getValues;
selectedRows = J(NRow(sv), 1, .);
for(i=1, i&amp;lt;=NRow(sv), i++,
	dist = (bv - sv[i])^2;
	selectedRows[i] = LocMin(dist);
);

// Subset dt1
dt3 = dt1 &amp;lt;&amp;lt; subset(rows(selectedRows), LinkToOriginalDataTable(1));

// Look at the distributions
NewWindow("Compare Distributions",
	HListBox(
		dt1 &amp;lt;&amp;lt; Distribution( Continuous Distribution( Column( :Values ) ) ),
		dt2 &amp;lt;&amp;lt; Distribution( Continuous Distribution( Column( :Values ) ) ),
		dt3 &amp;lt;&amp;lt; Distribution( Continuous Distribution( Column( :Values ) ) )
		)
	);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Oct 2018 10:08:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79315#M36670</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2018-10-17T10:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79388#M36690</link>
      <description>&lt;P&gt;Jeff,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your effort.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your suggestion had a slight chance. I applied it to my data and unfortunately since the selection is random, it did not work. I ran it for about 3000 iterations and stopped it after 10 hours. The movement on the mean of data was insignifcant.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This isn't a simple technique (unless your name is Ian) .. I would imagine some sort of optimizer being involved trying to random pull from the direction that it makes more sense. GA's may be an overkill but certainly can do this kind of optimization.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From statistical perspective, this is perfectly ok for what I do. The 400+K represents a big data of assets.. I am trying to find assets that are similar to a sub-group under investigation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks again.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 17:12:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79388#M36690</guid>
      <dc:creator>altug_bayram</dc:creator>
      <dc:date>2018-10-17T17:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79389#M36691</link>
      <description>&lt;P&gt;Ian,&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is brilliant. I sort of thought of a similar approach but was unable to do so due to my basic script knowledge.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to adapt it to my data and am getting what I want. I may perhaps expand this to 2-parameter distribution selection which I should be able to do from your script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your support.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 17:14:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79389#M36691</guid>
      <dc:creator>altug_bayram</dc:creator>
      <dc:date>2018-10-17T17:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79390#M36692</link>
      <description>&lt;P&gt;Ian,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Forgot to ask one question. Is your selection done uniquely from original table or does this have a chance to have duplicate selections into the sub-table ?&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 17:19:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79390#M36692</guid>
      <dc:creator>altug_bayram</dc:creator>
      <dc:date>2018-10-17T17:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79392#M36694</link>
      <description>Yes, I wondered about this. Right now it does, but if you don’t want duplicates, just add an extra line that sets the element of the vector ‘bv’ that has been found to missing ‘.’. &lt;BR /&gt;</description>
      <pubDate>Wed, 17 Oct 2018 17:38:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79392#M36694</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2018-10-17T17:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79405#M36698</link>
      <description>&lt;P&gt;Ian&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I was aiming to get ~46K of sub-sample data, of which 44K have been duplicates.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you pls write me that line for "bv" for your suggestion ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thx again.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 18:25:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79405#M36698</guid>
      <dc:creator>altug_bayram</dc:creator>
      <dc:date>2018-10-17T18:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79432#M36700</link>
      <description>I’m sorry - I won’t have access to a computer for a few days due to a vacation. But I’m sure someone else can do it . . .&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Oct 2018 18:33:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79432#M36700</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2018-10-17T18:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79463#M36714</link>
      <description>&lt;P&gt;The approach that&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3605"&gt;@ian_jmp&lt;/a&gt;&amp;nbsp;found was the first thing I tried, but I abandoned it too&amp;nbsp;early apparently as Ian found a way to overcome some shortcomings that I ran into. Nice job.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for eliminating resampling of rows, I believe that Ian was suggesting adding the line:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	bv[Loc Min( dist )] = .;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to the for() loop. Thusly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Make a big table
dt1 = New Table( "Big",
	New Column( "Values", Numeric, Continuous, Formula( Random Uniform( -3, 3 ) ) ),
	New Column("Row", Formula(Row()))
);
dt1 &amp;lt;&amp;lt; addRows( 40000 );
dt1 &amp;lt;&amp;lt; runFormulas;
Column( dt1, "Values" ) &amp;lt;&amp;lt; deleteFormula;

// Make a small table
dt2 = New Table( "Small",
	New Column( "Values", Numeric, Continuous, Formula( Random Normal( 0, 1 ) ) )
);
dt2 &amp;lt;&amp;lt; addRows( 40 );
dt2 &amp;lt;&amp;lt; runFormulas;
Column( dt2, "Values" ) &amp;lt;&amp;lt; deleteFormula;

// For each value in dt2, find a value in dt1 that's closest
bv = Column( dt1, "Values" ) &amp;lt;&amp;lt; getValues;
sv = Column( dt2, "Values" ) &amp;lt;&amp;lt; getValues;
selectedRows = J( N Row( sv ), 1, . );
For( i = 1, i &amp;lt;= N Row( sv ), i++,
	dist = (bv - sv[i]) ^ 2;
	selectedRows[i] = Loc Min( dist );
	//the line below prevents rows from the "Big" table from being re-sampled
	bv[Loc Min( dist )] = .;
);

// Subset dt1
dt3 = dt1 &amp;lt;&amp;lt; subset( rows( selectedRows ), LinkToOriginalDataTable( 1 ) );

// Look at the distributions
New Window( "Compare Distributions",
	H List Box(
		dt1 &amp;lt;&amp;lt; Distribution( Continuous Distribution( Column( :Values ) ) ),
		dt2 &amp;lt;&amp;lt; Distribution( Continuous Distribution( Column( :Values ) ) ),
		dt3 &amp;lt;&amp;lt; Distribution( Continuous Distribution( Column( :Values ) ) )
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Oct 2018 21:58:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79463#M36714</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2018-10-17T21:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79482#M36722</link>
      <description>&lt;P&gt;Jeff&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your modification on Ian's original solution worked perfectly. I can now extract random data w/ a prescribed distribution. It would be nice to see this as an option under Table Subsetting ...&lt;/P&gt;&lt;P&gt;My problem is 100% solved.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your support.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 01:51:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/79482#M36722</guid>
      <dc:creator>altug_bayram</dc:creator>
      <dc:date>2018-10-18T01:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/241733#M47751</link>
      <description>&lt;P&gt;You have got to be kidding me.&amp;nbsp; Getting a random sample from another column, and showing it to you in a separate column, is a menu selection in Minitab.&amp;nbsp; The answer to this took two pages of discussion and dozens of lines of code.&amp;nbsp; Why are simple things so difficult in JMP?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 13:59:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/241733#M47751</guid>
      <dc:creator>StevenJLandry</dc:creator>
      <dc:date>2020-01-17T13:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Random subset selection for a given distribution</title>
      <link>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/241749#M47755</link>
      <description>&lt;P&gt;The original request here was not for simple random sampling of another column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that's all you need you can use the &lt;A href="https://www.jmp.com/support/help/en/15.0/#page/jmp/random-functions.shtml#ww123082" target="_self"&gt;Col Shuffle() function&lt;/A&gt; to generate a new column with random selection from another.&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="2020-01-17_09-59-27.336.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/21031iA22B2966F531C69E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2020-01-17_09-59-27.336.png" alt="2020-01-17_09-59-27.336.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 15:00:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-subset-selection-for-a-given-distribution/m-p/241749#M47755</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2020-01-17T15:00:10Z</dc:date>
    </item>
  </channel>
</rss>

