Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- How to get Kaiser's MSA (aka KMO) in JMP's Factor ...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 18, 2012 9:41 AM
(1214 views)

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Solution

See if this code is helpful. I only was able to check it against the socioeconomic sample data and the results were same as the SAS results shown in the SAS docs online. Use at your own risk and certainly test on as many datasets as you have MSA results for.

/* Next line if want to open a specific JMP table */

//dt = Open( "$SAMPLE_DATA/Socioeconomic.jmp" );

/* Next line if want to have user pick a JMP data table */

//dt = Open();

/* No Open statement if want to run against the current data table */

cd = Column Dialog( Col ID = ColList( "Select Columns" ) );

names = cd["Col ID"];

nsel = N Items( names );

mv = Multivariate(

Y( Eval( names ) ),

Estimation Method( "Row-wise" ),

Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),

Partial Correlations( 1 )

);

rmv = Report( mv );

dtcorr = rmv["Correlations"][Matrix Box( 1 )] << make into data table;

dtpart = rmv["Partial Corr"][Matrix Box( 1 )] << make into data table;

stkcorr = dtcorr << Stack(

columns( Eval( names ) ),

Source Label Column( "Label" ),

Stacked Data Column( "Data" )

);

stkpart = dtpart << Stack(

columns( Eval( names ) ),

Source Label Column( "Label" ),

Stacked Data Column( "Data" )

);

Close( dtcorr, nosave );

Close( dtpart, nosave );

stkcorr << New Column( "DataSqr", formula( Data ^ 2 ) );

stkpart << New Column( "DataSqr", formula( Data ^ 2 ) );

sumsqrcorr = Col Sum( (stkcorr:"DataSqr") ) - nsel;

sumsqrpart = Col Sum( (stkpart:"DataSqr") );

MSA = sumsqrcorr / (sumsqrcorr + sumsqrpart);

//Show( MSA );

Summarize( bycorr = by( stkcorr:"Row" ), sumsqrcorrby = Sum( stkcorr:"DataSqr" ) );

Summarize( bypart = by( stkpart:"Row" ), sumsqrpartby = Sum( stkpart:"DataSqr" ) );

Close( stkcorr, nosave );

Close( stkpart, nosave );

//show(sumsqrcorrby, sumsqrpartby);

//show(bycorr, bypart);

sumsqrcorrby = sumsqrcorrby - 1;

//show(sumsqrcorrby);

MSAvar = {};

For( i = 1, i <= nsel, i++,

MSAvar* = sumsqrcorrby / (sumsqrcorrby + sumsqrpartby);*

//Show( bycorr*, MSAvar );*

);

sr = New Window( "Summary Results",

V List Box(

Table Box( String Col Box( "Variable", bycorr ), Number Col Box( "MSA", MSAvar ) ),

Text Box( "Overall MSA = " || Char( round(MSA, 5) ) )

)

);

2 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

See if this code is helpful. I only was able to check it against the socioeconomic sample data and the results were same as the SAS results shown in the SAS docs online. Use at your own risk and certainly test on as many datasets as you have MSA results for.

/* Next line if want to open a specific JMP table */

//dt = Open( "$SAMPLE_DATA/Socioeconomic.jmp" );

/* Next line if want to have user pick a JMP data table */

//dt = Open();

/* No Open statement if want to run against the current data table */

cd = Column Dialog( Col ID = ColList( "Select Columns" ) );

names = cd["Col ID"];

nsel = N Items( names );

mv = Multivariate(

Y( Eval( names ) ),

Estimation Method( "Row-wise" ),

Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),

Partial Correlations( 1 )

);

rmv = Report( mv );

dtcorr = rmv["Correlations"][Matrix Box( 1 )] << make into data table;

dtpart = rmv["Partial Corr"][Matrix Box( 1 )] << make into data table;

stkcorr = dtcorr << Stack(

columns( Eval( names ) ),

Source Label Column( "Label" ),

Stacked Data Column( "Data" )

);

stkpart = dtpart << Stack(

columns( Eval( names ) ),

Source Label Column( "Label" ),

Stacked Data Column( "Data" )

);

Close( dtcorr, nosave );

Close( dtpart, nosave );

stkcorr << New Column( "DataSqr", formula( Data ^ 2 ) );

stkpart << New Column( "DataSqr", formula( Data ^ 2 ) );

sumsqrcorr = Col Sum( (stkcorr:"DataSqr") ) - nsel;

sumsqrpart = Col Sum( (stkpart:"DataSqr") );

MSA = sumsqrcorr / (sumsqrcorr + sumsqrpart);

//Show( MSA );

Summarize( bycorr = by( stkcorr:"Row" ), sumsqrcorrby = Sum( stkcorr:"DataSqr" ) );

Summarize( bypart = by( stkpart:"Row" ), sumsqrpartby = Sum( stkpart:"DataSqr" ) );

Close( stkcorr, nosave );

Close( stkpart, nosave );

//show(sumsqrcorrby, sumsqrpartby);

//show(bycorr, bypart);

sumsqrcorrby = sumsqrcorrby - 1;

//show(sumsqrcorrby);

MSAvar = {};

For( i = 1, i <= nsel, i++,

MSAvar* = sumsqrcorrby / (sumsqrcorrby + sumsqrpartby);*

//Show( bycorr*, MSAvar );*

);

sr = New Window( "Summary Results",

V List Box(

Table Box( String Col Box( "Variable", bycorr ), Number Col Box( "MSA", MSAvar ) ),

Text Box( "Overall MSA = " || Char( round(MSA, 5) ) )

)

);

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 21, 2012 8:19 AM
(662 views)

The code worked like a charm!!! I ahev checked it on several data sets and results are identicla with what I get from running SAS. Thanks very much.

JMP folks (if you are listening in) - please incorporate this code/jsl in the next version of JMP as a red triangle option form multivariate correlation platform.