[R] How to calculate KMO?

G. Jay Kerns gkerns at ysu.edu
Wed Apr 13 00:30:58 CEST 2011


Dear Thibault,

On Tue, Apr 12, 2011 at 5:06 PM, Thibault Grava
<tybo.tout.seul at gmail.com> wrote:
> Hello Jay,
>
> I know that an old post but I really need to calculate KMO for my data and
> this is the only thread I found on the subject.
>
> I'm a very newby to R so sorry for the odd questions.
>
> It looks like in your reply that you use "kmo" as a function and you apply
> it to your data "D"... I tried that on my data but it says "Error: couldn't
> find function "kmo"". I installed and loaded the package "corpcor" but it
> still doesn't work... did I get it wrong?
>
> Also i would like to use the complete function (see
> http://tolstoy.newcastle.edu.au/R/help/05/12/17235.html), but I don't really
> understand how to use it... where should I enter the data directory??
>
> I thank you a lot for your help.
>
> Thibault
>


Please forgive me, but I'm not sure I really understand what your
question is.  My advice would be to go here:

https://stat.ethz.ch/pipermail/r-help/2007-August/138049.html

and copy-paste the function listed there - it looks like

kmo = function( data ){

...bunch of stuff here...

} # end of kmo()

into an R session, for instance, on the Windows RGui.  If you like,
you can test that everything works with the example shown right below
that (just copy-paste, again).  You don't need any corpcor package,
all you need is MASS which should have shipped with the R you are
using.

You also don't need a data directory.  What you need is a matrix
(called "X" in my message) with the data stored in the correct
order/positions.  See the Trujillo-Ortiz et al. discussion (linked in
my message) for lots more detail about what the matrix means and how
to set it up.  If you are having trouble setting up a data matrix in
general then I recommend the R documentation which you can find under
the Help menu.

I just double-checked and both the function and example still work
like a charm, almost 4 years later. (?!)

Good luck, and I hope this helps.
Jay


______________________________
G. Jay Kerns, Ph.D.
Youngstown State University
http://people.ysu.edu/~gkerns/



More information about the R-help mailing list