cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
ac111ca
Level I

Finding a correlation coefficient and putting it into a table

I have created 2 files to demonstrate my problem. 
 
In "Test 1" I have data from 4 people (i.e., AAAA, BBBB, CCCC, DDDD). Each person has 8 responses to an "estimate" question and 8 responses to a "truth" question. Half the responses are from Domain "0" and the other half from Domain "1".  
 
I would like to find the correlation of between the estimate and truth question for each person in each domain. I know that I can do that by going to Analyze / Multivariate Methods / Multivariate and putting the estimate and truth questions in the "Y, Columns" box, and both "ID" and "Domain" in the "By" box. 
 
The problem is that I want the output of this analysis to be in another JMP table so that I can do further analyses on the correlations. For example, I want to know what the average persons' correlation is between estimate and truth in each of the domains. In order to do this, I need a file that looks like the data in the "Test 2" file. 
 
Can you please tell me an automatic way to produce the "Test 2" data from the Test 1 data? I cannot do this manually because the actual dataset that I am working with is huge. 
1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X

Re: Finding a correlation coefficient and putting it into a table

You could explot the 'makeCombinedDataTableMessage'. In JSL, something like:

NamesDefaultToHere(1);

// Data table
dt = DataTable("Test 1.jmp");

// Multivariate
m = dt << Multivariate(Y( :Estimate, :Truth ), By( :ID, :Domain ));

// 'm' is a list because of the 'By' variable: Get the report for the first level
mRep = Report(m[1]);

// Get the correlation matrix into a table dt2 (for all levels)
dt2 = mRep[MatrixBox(1)] << makeCombinedDataTable;

// Manipulate dt2 to remove redundancy
dt2 << setName("Correlation Coefficients For By Groups");
dt2 << deleteColumns({3, 4});
r2del = dt2 << getRowsWhere(:Truth == 1);
dt2 << deleteRows(r2del);
Column(dt2, "Truth") << setName("Correlation Coefficient")

 

View solution in original post

2 REPLIES 2
ian_jmp
Level X

Re: Finding a correlation coefficient and putting it into a table

You could explot the 'makeCombinedDataTableMessage'. In JSL, something like:

NamesDefaultToHere(1);

// Data table
dt = DataTable("Test 1.jmp");

// Multivariate
m = dt << Multivariate(Y( :Estimate, :Truth ), By( :ID, :Domain ));

// 'm' is a list because of the 'By' variable: Get the report for the first level
mRep = Report(m[1]);

// Get the correlation matrix into a table dt2 (for all levels)
dt2 = mRep[MatrixBox(1)] << makeCombinedDataTable;

// Manipulate dt2 to remove redundancy
dt2 << setName("Correlation Coefficients For By Groups");
dt2 << deleteColumns({3, 4});
r2del = dt2 << getRowsWhere(:Truth == 1);
dt2 << deleteRows(r2del);
Column(dt2, "Truth") << setName("Correlation Coefficient")

 

ac111ca
Level I

Re: Finding a correlation coefficient and putting it into a table

Thank you, Ian. That works perfectly.

Recommended Articles