Learn R Programming

sjstats (version 0.2.0)

reliab_test: Performs a reliability test on an item scale

Description

This function calculates the item discriminations (corrected item-total correlations for each item of x with the remaining items) and the Cronbach's alpha for each item, if it was deleted from the scale.

Usage

reliab_test(x, scale.items = FALSE, digits = 3)

Arguments

x
data.frame with items (from a scale).
scale.items
Logical, if TRUE, the data frame's vectors will be scaled. Recommended, when the variables have different measures / scales.
digits
Amount of digits for Cronbach's Alpha and correlation values in returned data frame.

Value

A data frame with the corrected item-total correlations (item discrimination) and Cronbach's alpha (if item deleted) for each item of the scale, or NULL if data frame had too less columns.

See Also

cronb

Examples

Run this code
library(sjmisc)
# Data from the EUROFAMCARE sample dataset
data(efc)

# retrieve variable and value labels
varlabs <- get_label(efc)

# recveive first item of COPE-index scale
start <- which(colnames(efc) == "c82cop1")
# recveive last item of COPE-index scale
end <- which(colnames(efc) == "c90cop9")

# create data frame with COPE-index scale
x <- data.frame(efc[, c(start:end)])
colnames(x) <- varlabs[c(start:end)]

## Not run: 
# library(sjPlot)
# sjt.df(reliab_test(x), describe = FALSE, show.cmmn.row = TRUE,
#        string.cmmn = sprintf("Cronbach's α=%.2f", cronb(x)))
# 
# # Compute PCA on Cope-Index, and perform a
# # reliability check on each extracted factor.
# factors <- sjt.pca(x)$factor.index
# findex <- sort(unique(factors))
# library(sjPlot)
# for (i in 1:length(findex)) {
#  rel.df <- subset(x, select = which(factors == findex[i]))
#  if (ncol(rel.df) >= 3) {
#    sjt.df(reliab_test(rel.df), describe = FALSE, show.cmmn.row = TRUE,
#           use.viewer = FALSE, title = "Item-Total-Statistic",
#           string.cmmn = sprintf("Scale's overall Cronbach's α=%.2f",
#                                 cronb(rel.df)))
#    }
#  }## End(Not run)

Run the code above in your browser using DataLab