cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
mcs5
Level I

Generating random data based on correlation matrix

Is there a method to have JMP generate random data that fits a specified correlation matrix.  I want to be able to specify the desired correlation matrix (and sample size), and generate random (multivariate normal) data that is based on the specified matrix.

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Generating random data based on correlation matrix

Yes, although you have to use the attached script, or something similar. Open the script, then edit the matrix, means and number of samples desired, and then run the script. It will create a datatable housing the samples.

Cheers,

Brady

View solution in original post

Jeff_Perkinson
Community Manager Community Manager

Re: Generating random data based on correlation matrix

You can use the Simulator in the Profiler to generate this data for you.

Start by creating a data table with a column for each of your covariates.

6982_Pasted_Image_7_11_14__10_23_AM.png

Then create a column with a formula that simply sums those covariates. Really, this formula can be anything that references all of the covariate columns, we're only using this column to get to the Profiler. The example table attached here shows what I mean.

Launch the Profiler with your formula column.

6986_Pasted_Image_7_11_14__10_36_AM.png

Then turn on the Simulator.

6987_Pasted_Image_7_11_14__10_38_AM.png

6989_Pasted_Image_7_11_14__10_41_AM.png

Set each of your covariates to Multivariate. Set the Mean and SD for each covariate, then in X Correlations Specification outline node you can enter the correlation coefficients.

Set the N Runs field to the number of rows you want to simulate and open the Simulate to Table node and click the Make Table button.

6998_Pasted_Image_7_12_14__9_31_AM.png

For my example here's a Scatterplot matrix for the simulated data.

6999_Pasted_Image_7_12_14__9_32_AM.png

-Jeff

View solution in original post

3 REPLIES 3

Re: Generating random data based on correlation matrix

Yes, although you have to use the attached script, or something similar. Open the script, then edit the matrix, means and number of samples desired, and then run the script. It will create a datatable housing the samples.

Cheers,

Brady

Jeff_Perkinson
Community Manager Community Manager

Re: Generating random data based on correlation matrix

You can use the Simulator in the Profiler to generate this data for you.

Start by creating a data table with a column for each of your covariates.

6982_Pasted_Image_7_11_14__10_23_AM.png

Then create a column with a formula that simply sums those covariates. Really, this formula can be anything that references all of the covariate columns, we're only using this column to get to the Profiler. The example table attached here shows what I mean.

Launch the Profiler with your formula column.

6986_Pasted_Image_7_11_14__10_36_AM.png

Then turn on the Simulator.

6987_Pasted_Image_7_11_14__10_38_AM.png

6989_Pasted_Image_7_11_14__10_41_AM.png

Set each of your covariates to Multivariate. Set the Mean and SD for each covariate, then in X Correlations Specification outline node you can enter the correlation coefficients.

Set the N Runs field to the number of rows you want to simulate and open the Simulate to Table node and click the Make Table button.

6998_Pasted_Image_7_12_14__9_31_AM.png

For my example here's a Scatterplot matrix for the simulated data.

6999_Pasted_Image_7_12_14__9_32_AM.png

-Jeff
mcs5
Level I

Re: Generating random data based on correlation matrix

Works great!  Thanks.