Re: [R] KMO sampling adequacy and SPSS -- partial solution

From: Ashish Ranpura <buddhahead_at_ranpura.com>
Date: Thu 08 Dec 2005 - 10:19:37 EST

Sorry, there was an error in that function, a hangover from a previous session. The corrected function is:

kmo.test <- function(df){

###

## Calculate the Kaiser-Meyer-Olkin Measure of Sampling Adequacy.
## Input should be a data frame or matrix, output is the KMO statistic.
## Formula derived from Hutcheson et al, 1999,
## "The multivariate social scientist," page 224, ISBN 0761952012
## see <http://www2.chass.ncsu.edu/garson/pa765/hutcheson.htm>
###
	cor.sq = cor(df)^2
	cor.sumsq = (sum(cor.sq)-dim(cor.sq)[1])/2
	library(corpcor)
	pcor.sq = cor2pcor(cor(df))^2
	pcor.sumsq = (sum(pcor.sq)-dim(pcor.sq)[1])/2
	kmo = cor.sumsq/(cor.sumsq+pcor.sumsq)
	return(kmo)

}

--Ashish.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 08 10:30:54 2005

This archive was generated by hypermail 2.1.8 : Thu 08 Dec 2005 - 14:30:31 EST