This function calculates the Cronbach alpha for one or more sets of psychometric scale items. Each item is a variable in a data frame. Each set of items is defined by a tidy selection of a set of items.

cronbach(.data, ..., .ci = 0.95)

Arguments

.data

A data frame with columns that are psychometric items.

...

A set of comma separated tidy selectors that selects sets of columns from .data. For each set of columns, the Cronbach's alpha is computed.

.ci

The value of the confidence interval to calculate.

Value

A data frame whose rows are psychometric scales and for each scale, we have the Cronbach's alpha, and the lower and upper bound of the confidence interval on alpha.

Examples

 # Return the Cronbach alpha and 95% ci for two scales.
 # The first scale, named `x`, is identified by all items beginning with `x_`.
 # The second scale, named `y`, is identified by the consecutive items from `y_1` to `y_10`.
 cronbach(test_psychometrics,
          x = starts_with('x'),
          y = y_1:y_10)
#> # A tibble: 2 × 4
#>   scale alpha ci_lo ci_hi
#>   <chr> <dbl> <dbl> <dbl>
#> 1 x     0.620 0.452 0.788
#> 2 y     0.738 0.626 0.850