Subscribe Bookmark RSS Feed

How to get Kaiser's MSA (aka KMO) in JMP's Factor analysis?

goutam

Community Trekker

Joined:

Feb 18, 2012

The Kaiser's MSA (also called KMO) is a metric that is frequently used along with anti-image correlation matrix to judge the suitability of a set of variables for factor analsysis. I can get these easily uisng SAS (proc factor). Anyone knwos how to get these in JMP (I am using JMP Pro version 9)?  I see there was a post in early 2010 about KMO and the answer there was to literally calculate these by exporting the partial/inverse correlation matric to Excel. I am hoping by now, JMP or soem users have come up with a script or some options that do it automatically. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
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
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) ) )

    )

);

goutam

Community Trekker

Joined:

Feb 18, 2012

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.