Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!

Sample With Replacement Add-In

Use this add-in to illustrate the concept of resampling with replacement (this means that after an observation is selected, it is put back and can be selected again within the same sample).



Use Notes:

The add-in will use the active JMP data table, or will prompt you to open a data table if no JMP tables are open.  Here, we use the Big Class data from the sample data directory in JMP (under Help > Sample Data).  Note that the data must be stacked (i.e. the Y values must be stacked in one column, and the X labels must be stacked in a separate column).


Notes on the Dialog Window:

  • Select the columns you would like to resample from.
  • Specify the sample size ( the number of observations in each sample).  By default, this will be equal to the original sample size (i.e. so the sample will be bootstrapped), but it can be set to any positive integer.
  • Specify the number of samples.  By default, 1 sample will be drawn.


In the example below, 1 sample of size 40 will be drawn, with replacement, from the four columns selected.

How it Works and the Results:

For each sample, the the specified number of observations for the selected columns are sampled.  The observations are placed in a new data table in the order in which they are selected. The original row number is provided, along with the sample number. In the example below, 100 samples of size 40 were drawn, producing a total of 4000 observations.


Suggested Uses:


Draw 1 sample:

  • Look at the Original Row Number for the first row of the new data table.  Locate this observation in the original data table.
  • Use Analyze > Distribution to graph and summarize the variables and the Original Row Number column.
  • Look at the frequency distribution for the Original Row Number.  Were some observations drawn multiple times?  How many unique observations were drawn?
  • Compare the graphs and summary statistics for the resampled data to the original data.

Draw multiple samples:

  • Use Analyze > Distribution, with Sample Number in the By field, to graph one variable at a time.  Visually compare the graphs and summary statistics from one sample to another.
  • Use Analyze > Tabulate to summarize the data, and select Make Into Data Table from the top red triangle to create a data table of the summarized data.  Then, use the Distribution platform to compare the distribution and statistics for the summarized data to the original sample.


Revision History:

Sept 12, 2016 - Posted v0.14, which runs in JMP 12 SE.



The code was developed by julian (Julian Parris, JMP Academic Ambassador).  Thanks Julian!


Comments, feedback or suggestions, please let us know!  Do you have a cool JMP-based simulator or teaching tool that you'd be willing to share with other stat educators?  Please consider posting in the JMP Academic Teaching Room.