set.seed(42)
x <- matrix(rnorm(1000),ncol=10)
r <- cor(x)
cortest.bartlett(r) #random data don't differ from an identity matrix
#data(bfi)
cortest.bartlett(bfi[1:200,1:10]) #not an identity matrix
f3 <- fa(Thurstone,3)
f3r <- f3$resid
cortest.bartlett(f3r,n=213,diag=FALSE) #incorrect
cortest.bartlett(f3r,n=213,diag=TRUE) #correct (by default)
Run the code above in your browser using DataLab