multilevel.alpha: Multilevel Coefficient Alpha

View source: R/multilevel.alpha.R

multilevel.alphaR Documentation

Multilevel Coefficient Alpha

Description

This function computes point estimate and Monte Carlo confidence interval for the multilevel coefficient alpha defined by Lai (2021) by calling the cfa function in the R package lavaan. By default, the function prints level-specific multilevel coefficient alpha with 95% Monte Carlo confidence interval based on Huber-White standard errors.

Usage

multilevel.alpha(data, ..., cluster,
                 se = c("none", "standard", "robust.huber.white"),
                 optim.method = c("nlminb", "em"), missing = c("listwise", "fiml"),
                 nrep = 100000, seed = NULL, conf.level = 0.95,
                 print = c("all", "alpha", "item"), digits = 2, r.digits = 3,
                 as.na = NULL, write = NULL, append = TRUE, check = TRUE,
                 output = TRUE)

Arguments

data

a data frame. A saturated multilevel model is estimated to obtain variances and covariances at the Within and Between level. Note that the cluster variable specified in cluster is excluded from data when specifying the argument cluster using the variable name of the cluster variable.

...

an expression indicating the variable names in data, e.g., multilevel.alpha(dat, x1, x2, x3, cluster = "cluster"). Note that the operators +, -, ~, :, ::, and ! can also be used to select variables, see 'Details' in the df.subset function.

cluster

either a character string indicating the variable name of the cluster variable in data, or a vector representing the nested grouping structure (i.e., group or cluster variable).

se

a character string indicating the standard errors used for computing Monte Carlo confidence intervals, i.e., "none" for no standard errors, "standard" for conventional standard error based on inverting the expected observed or first.order information matrix, and "robust.huber.white" for the 'MLR' (aka pseudo ML, Huber-White) approach. Note that se = "none" saves computation time by not computing standard errors and Monte Carlo confidence intervals.

optim.method

a character string indicating the optimizer, i.e., "nlminb" (default) for the unconstrained and bounds-constrained quasi-Newton method optimizer and "em" for the Expectation Maximization (EM) algorithm.

missing

a character string indicating how to deal with missing data, i.e., "listwise" for listwise deletion or "fiml" (default) for full information maximum likelihood (FIML) method.

nrep

an integer value indicating the number of Monte Carlo repetitions for computing confidence intervals.

seed

a numeric value specifying the seed of the random number generator for computing the Monte Carlo confidence interval.

conf.level

a numeric value between 0 and 1 indicating the confidence level of the interval.

print

a character vector indicating which results to show, i.e. "all" (default) for all results "alpha" for the composite reliability alpha and "item" for item statistics. Note that standardized factor loadings at the within and between level printed when requesting "item" are based on a multilevel CFA model with factor loadings freely estimated across both levels.

digits

an integer value indicating the number of decimal places to be used for displaying mean, standard deviation, minimum, maximum, skewness, and kurtosis.

r.digits

an integer value indicating the number of decimal places to be used for displaying multilevel coefficient alpha, ICC(1), and standardized factor loadings.

as.na

a numeric vector indicating user-defined missing values, i.e. these values are converted to NA before conducting the analysis. Note that as.na() function is only applied to data but not to cluster.

write

a character string naming a file for writing the output into either a text file with file extension ".txt" (e.g., "Output.txt") or Excel file with file extension ".xlsx" (e.g., "Output.xlsx"). If the file name does not contain any file extension, an Excel file will be written.

append

logical: if TRUE (default), output will be appended to an existing text file with extension .txt specified in write, if FALSE existing text file will be overwritten.

check

logical: if TRUE (default), argument specification, convergence and model identification is checked.

output

logical: if TRUE (default), output is shown.

Details

In single-level data, coefficient \alpha (Cronbach, 1951) can be computed as

\alpha = \frac{2p\Sigma_{k=2}^p\Sigma_{k^{\prime}=1}^{k-1}\sigma_{kk^{\prime}}}{(p - 1)\mathbf{1}^{\prime}\mathbf{\Sigma}\mathbf{1}}

assuming that the covariance matrix of p items is \Sigma with elements \sigma_{ij^{\prime}}. Note that coefficients \alpha and \omega represent the same population quantities under unidimensionality and essential tau-equivalence. The multilevel extension of coefficient \alpha, however, does not require estimation of parameters of a factor model. Conseuqntly, its computation at the between-level remains the same regardless a composite is used to measure a configural construct or a shared construct.

Within-Level Composite

The reliability for an observed within-level composite, Z^w_{ij}, is

\alpha^w = \frac{2p\Sigma_{k=2}^p\Sigma_{k^{\prime}=1}^{k-1}\sigma_{kk^{\prime}}^w}{(p - 1)\mathbf{1}^{\prime}\mathbf{\Sigma}^w\mathbf{1}}

Between-Level Composite

The reliability for an observed between-level composite, Z^b_{j}, is

\alpha^b = \frac{2p\Sigma_{k=2}^p\Sigma_{k^{\prime}=1}^{k-1}\sigma_{kk^{\prime}}^b}{(p - 1)[\mathbf{1}^{\prime}\mathbf{\Sigma}^b\mathbf{1} + \mathbf{1}^{\prime}\mathbf{\Sigma}^w\mathbf{1} / \tilde{n}]}

Overall Composite

The reliability for an overall observed composite, Z_{ij}, capturing the population variance of both the within-level and the between-level components of the true score and the errors is

\alpha^{2l} = \frac{2p\Sigma_{k=2}^p\Sigma_{k^{\prime}=1}^{k-1}(\sigma_{kk^{\prime}}^w + \sigma_{kk^{\prime}}^b) }{(p - 1)[\mathbf{1}^{\prime}\mathbf{\Sigma}^b\mathbf{1} + \mathbf{1}^{\prime}\mathbf{\Sigma}^w\mathbf{1}]}

Note that \alpha^{2l} is simply the ratio of true variance to total variance of the observed scores. In practice, \alpha^{2l} is not the most interesting coefficient because researchers are mainly interested in distinguishing within- and between effects (Castro-Alvarez et al., 2026).

Value

Returns an object of class misty.object, which is a list with following entries:

call

function call

type

type of analysis

data

data frame specified in data including the group variable specified in cluster

args

specification of function arguments

model

specified model

model.fit

fitted lavaan object (mod.fit)

check

results of the convergence and model identification check

result

list with result tables, i.e., alpha for the coefficient alpha including Monte Carlo confidence interval and itemstat for descriptive statistics

Note

This function is based on the function multilevel_alpha from Mark Lai (2021 supplementary codes) and uses the functions lavInspect, lavTech, lavNames, parameterEstimates, and sem provided in the R package lavaan by Yves Rosseel (2012). The internal function .internal.mvrnorm is a copy of the mvrnorm function in the package MASS by Venables and Ripley (2002).

Author(s)

Takuya Yanagida takuya.yanagida@univie.ac.at

References

Cronbach, L. J. (1951). Coefficient alpha and the internal structure of tests. Psychometrika, 16, 297-334. http://dx.doi.org/10.1007/BF02310555

Lai, M. H. C. (2021). Composite reliability of multilevel data: It’s about observed scores and construct meanings. Psychological Methods, 26(1), 90–102. https://doi.org/10.1037/met0000287

Rosseel, Y. (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48, 1-36. https://doi.org/10.18637/jss.v048.i02

Venables, W. N., Ripley, B. D. (2002).Modern Applied Statistics with S (4th ed.). Springer. https://www.stats.ox.ac.uk/pub/MASS4/.

See Also

multilevel.omega, item.omega, multilevel.cfa, multilevel.fit, multilevel.invar, multilevel.cor, multilevel.descript, write.result

Examples

## Not run: 
# Load data set "Demo.twolevel" in the lavaan package
data("Demo.twolevel", package = "lavaan")

#————————————————————————————————————————————————————————————————————————————
# Cluster Variable Specification

# Example 1a: Specification using the argument '...'
multilevel.alpha(Demo.twolevel, y1:y4, cluster = "cluster")

# Example 1b: Alternative specification with cluster variable 'cluster' in 'data'
multilevel.alpha(Demo.twolevel[, c("y1", "y2", "y3", "y4", "cluster")], cluster = "cluster")

# Example 1c: Alternative specification with cluster variable 'cluster' not in 'data'
multilevel.alpha(Demo.twolevel[, c("y1", "y2", "y3", "y4")], cluster = Demo.twolevel$cluster)

#————————————————————————————————————————————————————————————————————————————
# Arguments 'se' and 'print'

# Example 4a: No confidence intervals to speed up computation
multilevel.alpha(Demo.twolevel, y1:y4, cluster = "cluster", se = "none")

# Example 4b: Alpha and item statistics
multilevel.alpha(Demo.twolevel, y1:y4, cluster = "cluster", print = "all")

#————————————————————————————————————————————————————————————————————————————
# Write Results

# Example 5a: Write results into a text file
multilevel.alpha(Demo.twolevel, y1, y2, y3, y4, cluster = "cluster",
                 write = "Multilevel_Alpha.txt")

# Example 5b: Write results into a Excel file
multilevel.alpha(Demo.twolevel, y1, y2, y3, y4, cluster = "cluster",
                 write = "Multilevel_Alpha.xlsx")

## End(Not run)

misty documentation built on Aug. 2, 2026, 9:06 a.m.