lib: reliability, agreement, correlations and bootstrap¶
Assorted helpers (extra lib): percentile bootstrap, scale reliability (Cronbach’s alpha, McDonald’s omega with
variants), inter-rater agreement (Fleiss’ kappa, Krippendorff’s alpha), pooling and comparing correlations, the HTMT
ratio and the Gini coefficient. Everything is imported from apatools.lib.
import numpy as np
from apatools.lib import (
bootstrap,
cronbachs_alpha,
mcdonald_omega,
mcdonald_omega_bifactor,
fleiss_kappa,
)
cil, m, cir = bootstrap(
[1, 2, 3, 4, 5, 6, 7, 8, 9], func=np.mean, n_rep=1000, conf_level=0.95
)
alpha, lower, upper = cronbachs_alpha(items) # analytic interval
omega, lower, upper = mcdonald_omega(items) # delta method, on the logit scale
omega, lower, upper = mcdonald_omega(
items, robust=True
) # robust to outlying respondents
table = mcdonald_omega_bifactor(
items, {"A": ["x1", "x2", "x3"], "B": ["x4", "x5", "x6"], "C": ["x7", "x8", "x9"]}
)
Design choices and caveats¶
Bootstrap. A percentile bootstrap: simple, but it can be biased and too narrow for small samples or skewed statistics; the interval is taken from the replications that are not missing.
Cronbach’s alpha. alpha = k/(k−1)·(1 − Σ item variances / variance of the sum score) from the sample covariance
matrix. It equals the reliability only for tau-equivalent items (equal loadings, uncorrelated errors) and otherwise
underestimates it: report it with omega (Kelley and Pornprasertmanit, 2016; Sijtsma, 2009). It changes when single
items are rescaled. The default interval is analytic, alpha ± z·ASE with the asymptotic standard error under normal
theory (van Zyl et al., 2000; Duhachek and Iacobucci, 2004), the upper limit capped at 1; it relies on normally
distributed items, so for skewed items, few categories or small samples use bootstrap_iter (Padilla et al., 2012).
Items must be keyed in the same direction (a warning is given otherwise).
McDonald’s omega.
Model. A one-factor model with unequal loadings (congeneric items), estimated by maximum likelihood by apatools with numpy and scipy.
Standardized by default. Omega of the standardized items does not change when items are rescaled or shifted.
standardized=Falsegives the reliability of the raw sum score, the definition of lavaan/semTools and of Zhang and Yuan (2016); the two differ when the items have different variances.Interval. The default is a delta-method interval (normal-theory ML, computed on the logit scale so that it stays inside (0, 1));
bootstrap_itergives a percentile bootstrap interval.Robust omega (
robust=True,varphi=0.1; Zhang and Yuan, 2016). The covariance matrix of the items is a Huber-type M-estimate that gives cases far from the center weights below one (a sharevarphiof the cases is downweighted under normality), and the interval uses the sandwich covariance matrix of the estimator;varphi=0keeps the sample covariance matrix with the distribution-free standard error. In simulations with 8 % outlying respondents the ordinary omega fell from .82 to .57 while the robust omega stayed at .79; the robust interval is then still somewhat too narrow (coverage about 70 %), so usebootstrap_iterwhen outliers are many.Bifactor omega (
mcdonald_omega_bifactor). A confirmatory bifactor model (a general factor and one uncorrelated group factor per subscale; at least two groups of at least three items; items outside the groups load on the general factor only) gives omega hierarchical (omega_h), omega total (omega_t), the explained common variance (ecv) and the subscale omegas (omega_s,omega_hs), with delta-method (sandwich) or bootstrap intervals and the samerobust,varphiandstandardizedoptions. Bifactor solutions can be improper in small samples (a uniqueness at zero, a Heywood case; in about 1–2 % of simulated samples of 500): the analytic interval is then not available and the bootstrap is the alternative.
Fleiss’ kappa. The agreement of several raters, with a z test against chance agreement. The standard error is the
null variance of Fleiss, Nee and Landis (1979), as in R’s irr::kappam.fleiss. A missing rating is not a category: items
with a missing rating are left out (NaN in the per-item agreement). The one-tailed p-value uses the signed z. The
interpretation bands of Landis and Koch (1977) are conventions; the test tells whether the agreement exceeds chance,
not how large it is.
Krippendorff’s alpha. 1 − D_o/D_e for any number of raters, with missing ratings (excluded, not counted as a
category; units with fewer than two ratings are ignored) and four levels of measurement (nominal, ordinal, interval,
ratio: the values are used, not the position of a category). A permutation z-score and p-value are added. Krippendorff recommends alpha ≥ .80 for firm conclusions
and ≥ .667 for tentative ones.
Comparing and pooling correlations.
dependent_correlations(two correlations that share a variable): Williams’ t test as given by Steiger (1980), or Zou’s (2007) confidence interval of the difference;independent_correlations: a z test on the Fisher-transformed correlations, or Zou’s interval.rz_ciandrho_rxy_rxzare the building blocks.average_correlationspools correlations on Fisher’s z scale with the weightsn − 3: a fixed-effect model that assumes one common population correlation. Heterogeneity is neither tested nor modelled; use a random-effects model for that.The confidence level is
conf_level(0.95); withmethod="one-tailed"both limits use the one-sided critical value.
HTMT ratio. The similarity of items of different constructs relative to items of the same construct; values near 1 mean that the constructs are not empirically distinct. Thresholds .85 (conservative) or .90 (liberal; Henseler et al., 2015) are conventions, and the bootstrap interval that would show an HTMT significantly below them is not provided. At least two items per construct are needed.
Gini coefficient. The sample Gini without the n/(n−1) correction, identical to ineq::Gini(x, corr=FALSE) in R.
Negative values are not allowed: if any value is below tolerance, all values are shifted by the absolute minimum
(which changes the result), and unless drop_zeros a tolerance is added so that no value is exactly zero.
Transformations. z_transform standardizes with the mean and the population standard deviation (constant or
all-NaN input gives NaN with ignore_errors=True, instead of dividing by zero). log_transform is the signed
pseudo-logarithm sign(x)·log10(1 + |x|).
Where it differs from R¶
what |
apatools |
R |
difference |
|---|---|---|---|
Fleiss’ kappa standard error |
Fleiss–Nee–Landis null variance |
|
the same formula |
McDonald’s omega, bifactor |
one-factor / bifactor ML in numpy |
|
estimates within 2e-5, standard errors within 1 % |
robust omega |
Huber M-estimate with sandwich |
|
estimates within 1e-5, standard errors within 2 % (0.3 % in the check against the package) |
omega definition |
standardized items by default |
lavaan, semTools: raw sum score |
use |
Gini |
sample Gini |
|
the same |
Krippendorff’s alpha |
rows are units |
Python |
transposed input |
Checked against¶
tests/test_mcdonald.py compares the bifactor omega with lavaan and the robust omega with the R package
coefficientalpha (skipped without R), and the delta-method intervals with simulations; tests/test_lib.py the Fleiss
kappa with published reference values and the formula of irr, Krippendorff’s alpha with the published example, the
definition and invariances, and the correlation tests with their definitions.
Literature¶
The references cited in the docstrings of the functions of this module (they are collected from the docstrings when the documentation is built; the software that does the work is on the software page).
Browne, M. W. (1984). Asymptotically distribution-free methods for the analysis of covariance structures. British Journal of Mathematical and Statistical Psychology, 37(1), 62-83. https://doi.org/10.1111/j.2044-8317.1984.tb00789.x
Cronbach, L. J. (1951). Coefficient alpha and the internal structure of tests. Psychometrika, 16(3), 297-334. https://doi.org/10.1007/BF02310555
Duhachek, A., & Iacobucci, D. (2004). Alpha’s standard error (ASE): An accurate and precise confidence interval estimate. Journal of Applied Psychology, 89(5), 792-808. https://doi.org/10.1037/0021-9010.89.5.792
Efron, B., & Tibshirani, R. J. (1993). An Introduction to the Bootstrap. Chapman & Hall. https://doi.org/10.1007/978-1-4899-4541-9
Fisher, R. A. (1921). On the “probable error” of a coefficient of correlation deduced from a small sample. Metron. Williams, E. J. (1959). The comparison of regression variables. Journal of the Royal Statistical Society Series B: Statistical Methodology, 21(2), 396-399. https://doi.org/10.1111/j.2517-6161.1959.tb00346.x Steiger, J. H. (1980). Tests for comparing elements of a correlation matrix. Psychological Bulletin, 87(2), 245-251. https://doi.org/10.1037/0033-2909.87.2.245 Zou, G. Y. (2007). Toward using confidence intervals to compare correlations. Psychological Methods, 12(4), 399-413. https://doi.org/10.1037/1082-989X.12.4.399 Hedges, L. V., & Olkin, I. (1985). Statistical Methods for Meta-Analysis. Academic Press.
Fleiss, J. L. (1971). Measuring nominal scale agreement among many raters. Psychological Bulletin, 76(5), 378-382. https://doi.org/10.1037/h0031619 Fleiss, J. L., Nee, J. C. M., & Landis, J. R. (1979). Large sample variance of kappa in the case of different sets of raters. Psychological Bulletin, 86(5), 974-977. https://doi.org/10.1037/0033-2909.86.5.974 Landis, J. R., & Koch, G. G. (1977). The measurement of observer agreement for categorical data. Biometrics, 33(1), 159-174. https://doi.org/10.2307/2529310
Flora, D. B. (2020). Your coefficient alpha is probably wrong, but which coefficient omega is right? A tutorial on using R to obtain better reliability estimates. Advances in Methods and Practices in Psychological Science, 3(4), 484-501. https://doi.org/10.1177/2515245920951747
Gini, C. (1912). Variabilità e mutabilità. Bologna: Tipografia di Paolo Cuppini. Lorenz, M. O. (1905). Methods of measuring the concentration of wealth. Publications of the American Statistical Association, 9(70), 209-219. https://doi.org/10.1080/15225437.1905.10503443 Sen, A. (1973). On Economic Inequality. Oxford: Clarendon Press.
Hedges, L. V., & Olkin, I. (1985). Statistical Methods for Meta-Analysis. Academic Press. Borenstein, M., Hedges, L. V., Higgins, J. P. T., & Rothstein, H. R. (2009). Introduction to Meta-Analysis. Wiley (ch. 6: correlations on Fisher’s z scale; ch. 11: fixed-effect model). https://doi.org/10.1002/9780470743386
Henseler, J., Ringle, C. M., & Sarstedt, M. (2015). A new criterion for assessing discriminant validity in variance-based structural equation modeling. Journal of the Academy of Marketing Science, 43(1), 115-135. https://doi.org/10.1007/s11747-014-0403-8 Kline, R. B. (2011). Principles and Practice of Structural Equation Modeling (3rd ed.). Guilford. Gold, A. H., Malhotra, A., & Segars, A. H. (2001). Knowledge management: An organizational capabilities perspective. Journal of Management Information Systems, 18(1), 185-214. https://doi.org/10.1080/07421222.2001.11045669
Kelley, K., & Pornprasertmanit, S. (2016). Confidence intervals for population reliability coefficients: Evaluation of methods, recommendations, and software for composite measures. Psychological Methods, 21(1), 69-92. https://doi.org/10.1037/a0040086
Krippendorff, K. (2011). Computing Krippendorff’s alpha-reliability. Annenberg School for Communication Departmental Papers. https://repository.upenn.edu/asc_papers/43
Lorenz, M. O. (1905). Methods of measuring the concentration of wealth. Publications of the American Statistical Association, 9(70), 209-219. https://doi.org/10.1080/15225437.1905.10503443 Gini, C. (1912). Variabilità e mutabilità. Bologna: Tipografia di Paolo Cuppini.
McDonald, R. P. (1999). Test Theory: A Unified Treatment. Lawrence Erlbaum. https://doi.org/10.4324/9781410601087
Padilla, M. A., Divers, J., & Newton, M. (2012). Coefficient alpha bootstrap confidence interval under nonnormality. Applied Psychological Measurement, 36, 331-348. https://doi.org/10.1177/0146621612445470
Raykov, T. (2002). Analytic estimation of standard error and confidence interval for scale reliability. Multivariate Behavioral Research, 37(1), 89-103. https://doi.org/10.1207/s15327906mbr3701_04
Raykov, T., & Shrout, P. E. (2002). Reliability of scales with general structure: Point and interval estimation using a structural equation modeling approach. Structural Equation Modeling: A Multidisciplinary Journal, 9(2), 195-212. https://doi.org/10.1207/S15328007SEM0902_3
Reise, S. P. (2012). The rediscovery of bifactor measurement models. Multivariate Behavioral Research, 47(5), 667-696. https://doi.org/10.1080/00273171.2012.715555
Revelle, W., & Zinbarg, R. E. (2009). Coefficients alpha, beta, omega, and the glb: Comments on Sijtsma. Psychometrika, 74(1), 145-154. https://doi.org/10.1007/s11336-008-9102-z
Rodriguez, A., Reise, S. P., & Haviland, M. G. (2016). Evaluating bifactor models: Calculating and interpreting statistical indices. Psychological Methods, 21(2), 137-150. https://doi.org/10.1037/met0000045
Sijtsma, K. (2009). On the use, the misuse, and the very limited usefulness of Cronbach’s alpha. Psychometrika, 74(1), 107-120. https://doi.org/10.1007/s11336-008-9101-0
van Zyl, J. M., Neudecker, H., & Nel, D. G. (2000). On the distribution of the maximum likelihood estimator of Cronbach’s alpha. Psychometrika, 65(3), 271-280. https://doi.org/10.1007/BF02296146
Yuan, K.-H., & Bentler, P. M. (1998). Structural equation modeling with robust covariances. Sociological Methodology, 28(1), 363-396. https://doi.org/10.1111/0081-1750.00052
Yuan, K.-H., & Bentler, P. M. (2002). On robustness of the normal-theory based asymptotic distributions of three reliability coefficient estimates. Psychometrika, 67(2), 251-259. https://doi.org/10.1007/BF02294845
Zhang, Z., & Yuan, K.-H. (2016). Robust coefficients alpha and omega and confidence intervals with outlying observations and missing data: Methods and software. Educational and Psychological Measurement, 76(3), 387-411. https://doi.org/10.1177/0013164415594658
Zinbarg, R. E., Revelle, W., Yovel, I., & Li, W. (2005). Cronbach’s alpha, Revelle’s beta, and McDonald’s omega h: Their relations with each other and two alternative conceptualizations of reliability. Psychometrika, 70(1), 123-133. https://doi.org/10.1007/s11336-003-0974-7
Zou, G. Y. (2007). Toward using confidence intervals to compare correlations. Psychological Methods, 12(4), 399-413. https://doi.org/10.1037/1082-989x.12.4.399 Dunn, O. J., & Clark, V. A. (1969). Correlation coefficients measured on the same individuals. Journal of the American Statistical Association, 64(325), 366-377. https://doi.org/10.1080/01621459.1969.10500981