coef_alpha: Compute coefficient alpha (Cronbach's alpha)

View source: R/helpers.R

coef_alphaR Documentation

Compute coefficient alpha (Cronbach's alpha)

Description

Computes Cronbach's coefficient alpha from item-level data. Uses listwise-complete cases by default. The implementation follows the standard formula

\alpha = \frac{k}{k-1}\left(1 - \frac{\sum_i s_i^2}{s_T^2}\right)

where k is the number of items, s_i^2 are item variances, and s_T^2 is the variance of the total score.

Usage

coef_alpha(items, na.rm = TRUE)

Arguments

items

A data frame, matrix, or list-like object whose columns are item-level responses (one row per respondent).

na.rm

Logical. If TRUE (default), use complete cases only.

Value

A numeric scalar, the value of coefficient alpha.

Examples

set.seed(1)
items <- matrix(rnorm(400), ncol = 4)
coef_alpha(items)

ltgsmd documentation built on Sept. 27, 2026, 5:07 p.m.