cortest.bartlett.Rd
Bartlett (1951) proposed that -ln(det(R)*(N-1 - (2p+5)/6) was distributed as chi square if R were an identity matrix. A useful test that residuals correlations are all zero. Contrast to the Kaiser-Meyer-Olkin test.
cortest.bartlett(R, n = NULL,diag=TRUE)
More useful for pedagogical purposes than actual applications. The Bartlett test is asymptotically chi square distributed.
Note that if applied to residuals from factor analysis (fa
) or principal components analysis (principal
) that the diagonal must be replaced with 1s. This is done automatically if diag=TRUE. (See examples.)
An Alternative way of testing whether a correlation matrix is factorable (i.e., the correlations differ from 0) is the Kaiser-Meyer-Olkin KMO
test of factorial adequacy.
Assymptotically chisquare
Of chi square
The degrees of freedom
Bartlett, M. S., (1951), The Effect of Standardization on a chi square Approximation in Factor Analysis, Biometrika, 38, 337-344.
set.seed(42)
x <- matrix(rnorm(1000),ncol=10)
r <- cor(x)
cortest.bartlett(r) #random data don't differ from an identity matrix
#> Warning: n not specified, 100 used
#> $chisq
#> [1] 17.60139
#>
#> $p.value
#> [1] 0.9999209
#>
#> $df
#> [1] 45
#>
#data(bfi)
cortest.bartlett(bfi[1:200,1:10]) #not an identity matrix
#> R was not square, finding R from data
#> $chisq
#> [1] 366.5438
#>
#> $p.value
#> [1] 5.487012e-52
#>
#> $df
#> [1] 45
#>
f3 <- fa(Thurstone,3)
f3r <- f3$resid
cortest.bartlett(f3r,n=213,diag=FALSE) #incorrect
#> $chisq
#> [1] 2203.356
#>
#> $p.value
#> [1] 0
#>
#> $df
#> [1] 36
#>
cortest.bartlett(f3r,n=213,diag=TRUE) #correct (by default)
#> $chisq
#> [1] 0.256498
#>
#> $p.value
#> [1] 1
#>
#> $df
#> [1] 36
#>