BARTLETT: Bartlett's test of sphericity

View source: R/BARTLETT.R

BARTLETTR Documentation

Bartlett's test of sphericity

Description

This function tests whether a correlation matrix is significantly different from an identity matrix (Bartlett, 1951). If the Bartlett's test is not significant, the correlation matrix is not suitable for factor analysis because the variables show too little covariance.

Usage

BARTLETT(
  x,
  N = NA,
  use = c("pairwise.complete.obs", "all.obs", "complete.obs", "everything",
    "na.or.complete"),
  cor_method = c("pearson", "spearman", "kendall")
)

Arguments

x

data.frame or matrix. Dataframe or matrix of raw data or matrix with correlations.

N

numeric. The number of observations. Needs only be specified if a correlation matrix is used.

use

character. Passed to stats::cor if raw data is given as input. Default is "pairwise.complete.obs".

cor_method

character. Passed to stats::cor. Default is "pearson".

Details

Bartlett (1951) proposed this statistic to determine a correlation matrix' suitability for factor analysis. The statistic is approximately chi square distributed with df = \frac{p(p - 1)}{2} and is given by

chi^2 = -log(det(R)) (N - 1 - (2 * p + 5)/6)

where det(R) is the determinant of the correlation matrix, N is the sample size, and p is the number of variables.

This tests requires multivariate normality. If this condition is not met, the Kaiser-Meyer-Olkin criterion (KMO) can still be used.

This function was heavily influenced by the psych::cortest.bartlett function from the psych package.

The BARTLETT function can also be called together with the (KMO) function and with factor retention criteria in the N_FACTORS function.

Value

A list containing

chisq

The chi square statistic.

p_value

The p value of the chi square statistic.

df

The degrees of freedom for the chi square statistic.

settings

A list of the settings used.

Source

Bartlett, M. S. (1951). The effect of standardization on a Chi-square approximation in factor analysis. Biometrika, 38, 337-344.

See Also

KMO for another measure to determine suitability for factor analysis.

N_FACTORS as a wrapper function for this function, KMO and several factor retention criteria.

Examples

BARTLETT(test_models$baseline$cormat, N = 500)


EFAtools documentation built on Jan. 6, 2023, 5:16 p.m.