<?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: monte carlo resapling simulation for mean and std dev jmp 14 in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/634362#M83230</link>
    <description>&lt;P&gt;The Random Integer() function returns an integer over a range of values with equal probability (uniform distribution function).&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="rand.PNG" style="width: 958px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/53006i9F98030E181AA68D/image-size/large?v=v2&amp;amp;px=999" role="button" title="rand.PNG" alt="rand.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is the third argument in the call to the J() function. It is evaluated row-wise during the making of the matrix that is, in turn, supplied as the subscripts to the original data matrix. This use is equivalent to sampling with replacement, which is what you want for resampled sample statistics.&lt;/P&gt;</description>
    <pubDate>Tue, 23 May 2023 13:56:00 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2023-05-23T13:56:00Z</dc:date>
    <item>
      <title>monte carlo resapling simulation for mean and std dev jmp 14</title>
      <link>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/633669#M83187</link>
      <description>&lt;P&gt;I am having trouble debugging&amp;nbsp; the portion on resampling. Help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dt=Current Data Table();&lt;BR /&gt;n=N Row(dt);&lt;BR /&gt;nSim=1000;&lt;BR /&gt;dtMC=New Table("MC", New Column ("Sim", Numeric, "Continuous"), New Column ("Mean", Numeric, "Continuous"), New Column ("Std Dev", Numeric, "Continuous");&lt;BR /&gt;For(i=1, i&amp;lt;=nSim, i++,&lt;BR /&gt;dtResample=dt&amp;lt;&amp;lt;Resample(Size(n), With Replacement(1), Seed(i));&lt;BR /&gt;dtMC&amp;lt;&amp;lt;Add Rows(1);&lt;BR /&gt;dtMC:Sim[i]=i;&lt;BR /&gt;dtMC:Mean[i]=Mean(dtResample:X)&lt;BR /&gt;dtMC:Std Dev[i]= Std Dev(dtResample:X);&lt;BR /&gt;);&lt;BR /&gt;dtMC&amp;lt;&amp;lt;Graph Builder(&lt;BR /&gt;Size(400, 300),&lt;BR /&gt;Variables (X(:Sim), Y(:Mean)),&lt;BR /&gt;Elements(Points(X,Y))&lt;BR /&gt;);&lt;/P&gt;</description>
      <pubDate>Sun, 21 May 2023 01:52:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/633669#M83187</guid>
      <dc:creator>AlphaMeanMarten</dc:creator>
      <dc:date>2023-05-21T01:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: monte carlo resapling simulation for mean and std dev jmp 14</title>
      <link>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/634054#M83206</link>
      <description>&lt;P&gt;It is difficult for me to diagnose the error in your script. Perhaps another member can help with that problem. I will use it as an opportunity to show you an alternate way. If you were interactively resampling using the data table commands, your way makes perfect sense. You can instead use matrix operations in a script.&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 );

// example
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// dt=Current Data Table();

// original data as a vector
data = dt:weight &amp;lt;&amp;lt; Get As Matrix;

n = N Row( data );
nSim = 1000;

// matrix of simulation results
sim = J( nSim, 3, . );

// resample statistics
For( i = 1, i &amp;lt;= nSim, i++,
	X = data[J( n, 1, Random Integer( 1, n ) )];
	sim[i, 1] = i;
	sim[i, 2] = Mean( X );
	sim[i, 3] = Std Dev( X );
);

// make data tabel from matrix
dtMC = As Table( sim, &amp;lt;&amp;lt;Column Names( {"Simulation", "Mean", "Std Dev"} ) );

// plot resampled statistics

dtMC &amp;lt;&amp;lt; Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Variables( X( :Simulation ), Y( :Mean ) ),
	Elements( Points( X, Y, Legend( 3 ) ) )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 May 2023 14:48:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/634054#M83206</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-05-22T14:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: monte carlo resapling simulation for mean and std dev jmp 14</title>
      <link>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/634168#M83217</link>
      <description>&lt;P&gt;this definitely helped. one question. How does the "random&lt;EM&gt; integer " function work? Are there different techniques for resampling ? Perhaps more control on how resampling is done? thanks again :)&lt;/img&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 02:24:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/634168#M83217</guid>
      <dc:creator>AlphaMeanMarten</dc:creator>
      <dc:date>2023-05-23T02:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: monte carlo resapling simulation for mean and std dev jmp 14</title>
      <link>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/634362#M83230</link>
      <description>&lt;P&gt;The Random Integer() function returns an integer over a range of values with equal probability (uniform distribution function).&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="rand.PNG" style="width: 958px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/53006i9F98030E181AA68D/image-size/large?v=v2&amp;amp;px=999" role="button" title="rand.PNG" alt="rand.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is the third argument in the call to the J() function. It is evaluated row-wise during the making of the matrix that is, in turn, supplied as the subscripts to the original data matrix. This use is equivalent to sampling with replacement, which is what you want for resampled sample statistics.&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 13:56:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/634362#M83230</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-05-23T13:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: monte carlo resapling simulation for mean and std dev jmp 14</title>
      <link>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/635218#M83341</link>
      <description>&lt;P&gt;Seems like it will replace one row in each simulation. Is it possible to generate random integer values in multiple rows?&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 03:24:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/635218#M83341</guid>
      <dc:creator>AlphaMeanMarten</dc:creator>
      <dc:date>2023-05-25T03:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: monte carlo resapling simulation for mean and std dev jmp 14</title>
      <link>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/635526#M83369</link>
      <description>&lt;P&gt;I do not understand your assumption ("&lt;SPAN&gt;Seems like it will replace one row in each simulation.&lt;/SPAN&gt;") or your question ("&lt;SPAN&gt;Is it possible to generate random integer values in multiple rows?&lt;/SPAN&gt;"). The script is correct for resampling statistics. I am using a vectorized solution that might be unfamiliar to you. A modified version of the script includes the distribution of the resampled estimates of the mean and the original estimate using the Distribution platform.&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 );

// example
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// dt=Current Data Table();

// original data as a vector
data = dt:weight &amp;lt;&amp;lt; Get As Matrix;
sampleMean = Col Mean( dt:weight );

n = N Row( data );
nSim = 1000;

// matrix of simulation results
sim = J( nSim, 3, . );

// resample statistics
For( i = 1, i &amp;lt;= nSim, i++,
	X = data[J( n, 1, Random Integer( 1, n ) )];
	sim[i, 1] = i;
	sim[i, 2] = Mean( X );
	sim[i, 3] = Std Dev( X );
);

// make data tabel from matrix
dtMC = As Table( sim, &amp;lt;&amp;lt;Column Names( {"Simulation", "Mean", "Std Dev"} ) );

// plot resampled statistics

dtMC &amp;lt;&amp;lt; Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Variables( X( :Simulation ), Y( :Mean ) ),
	Elements( Points( X, Y, Legend( 3 ) ) )
);

obj = dtMC &amp;lt;&amp;lt; Distribution( Y( :Mean ) );
rpt = obj &amp;lt;&amp;lt; Report;
rpt[AxisBox(1)] &amp;lt;&amp;lt; Add Ref Line( sampleMean, "Solid", "Red", "Sample Mean", 1, 0 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you attempting something else? Please explain your last reply in more detail.&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 13:49:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/635526#M83369</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-05-25T13:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: monte carlo resapling simulation for mean and std dev jmp 14</title>
      <link>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/638072#M83594</link>
      <description>&lt;P&gt;Apologies for the confusion. In the 1st script, how do I extract X from each iteration into a table so that I have all the values simulated in 1000 iterations? Thanks again for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;Names Default To Here( 1 );

// example
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// dt=Current Data Table();

// original data as a vector
data = dt:weight &amp;lt;&amp;lt; Get As Matrix;

n = N Row( data );
nSim = 1000;

// matrix of simulation results
sim = J( nSim, 3, . );

// resample statistics
For( i = 1, i &amp;lt;= nSim, i++,
	X = data[J( n, 1, Random Integer( 1, n ) )];
	sim[i, 1] = i;
	sim[i, 2] = Mean( X );
	sim[i, 3] = Std Dev( X );
);

// make data tabel from matrix
dtMC = As Table( sim, &amp;lt;&amp;lt;Column Names( {"Simulation", "Mean", "Std Dev"} ) );

// plot resampled statistics

dtMC &amp;lt;&amp;lt; Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Variables( X( :Simulation ), Y( :Mean ) ),
	Elements( Points( X, Y, Legend( 3 ) ) )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 03:04:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/638072#M83594</guid>
      <dc:creator>AlphaMeanMarten</dc:creator>
      <dc:date>2023-06-02T03:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: monte carlo resapling simulation for mean and std dev jmp 14</title>
      <link>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/638164#M83602</link>
      <description>&lt;P&gt;This script produces two data tables: one table with the resampled data and another with the resampled statistics.&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 );

// example
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// dt=Current Data Table();

// original data as a vector
data = dt:weight &amp;lt;&amp;lt; Get As Matrix;
sampleMean = Col Mean( dt:weight );
sampleSD = Col Std Dev( dt:weight );

n = N Row( data );
nSim = 1000;

// matrix of simulation data
simData = [];

// resample data
For( i = 1, i &amp;lt;= nSim, i++,
	X = data[J( n, 1, Random Integer( 1, n ) )];
	simData ||= X;
);

// make table of resampled data
colNames = List();
For( i = 1, i &amp;lt;= nSim, i++, Insert Into( colNames, Eval( "Sample " || Char( i ) ) ) );
dtSimData = As Table( simData, &amp;lt;&amp;lt; Column Names( colNames ) );

// matrix of simulation results
simStat = J( nSim, 3, . );

// resample statistics
For( i = 1, i &amp;lt;= nSim, i++,
	simStat[i, 1] = i;
	simStat[i, 2] = Mean( simData[0,i] );
	simStat[i, 3] = Std Dev( simData[0,i] );
);

// make data table from matrix
dtMC = As Table( simStat, &amp;lt;&amp;lt; Column Names( {"Simulation", "Mean", "Std Dev"} ) );

// plot resampled statistics
dtMC &amp;lt;&amp;lt; Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Variables( X( :Simulation ), Y( :Mean ), Y( :Std Dev ) ),
	Elements( Position( 1, 1 ), Points( X, Y, Legend( 3 ) ) ),
	Elements( Position( 1, 2 ), Points( X, Y, Legend( 4 ) ) )
);
obj = dtMC &amp;lt;&amp;lt; Distribution( Y( :Mean, :Std Dev ) );
rpt = obj &amp;lt;&amp;lt; Report;
rpt[AxisBox(1)] &amp;lt;&amp;lt; Add Ref Line( sampleMean, "Solid", "Red", "Sample Mean", 1, 0 );
rpt[AxisBox(2)] &amp;lt;&amp;lt; Add Ref Line( sampleSD, "Solid", "Red", "Sample Std Dev", 1, 0 );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Jun 2023 12:12:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/638164#M83602</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-06-02T12:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: monte carlo resapling simulation for mean and std dev jmp 14</title>
      <link>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/643610#M84031</link>
      <description>&lt;P&gt;Thanks. A question. If I have a data set [1 2 3 5 8 9 7] and I want to follow the logic above and do 2 iterations, will it create&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 sets by randomly selecting&amp;nbsp; numbers from the data set by replacing each location ? for example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[3 2 1 5 8 7 7]&lt;/P&gt;&lt;P&gt;[9 1 3 5 2 8 6]&lt;/P&gt;&lt;P&gt;If this is truly random, doesn't it mean every time its run we will get different data sets?&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2023 02:35:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/monte-carlo-resapling-simulation-for-mean-and-std-dev-jmp-14/m-p/643610#M84031</guid>
      <dc:creator>AlphaMeanMarten</dc:creator>
      <dc:date>2023-06-17T02:35:37Z</dc:date>
    </item>
  </channel>
</rss>

