R/mu4.R

Defines functions mu4

Documented in mu4

#' Obtain Ten Berge and Socan's (2004) mu4
#'
#' Obtain Ten Berge and Socan's (2004) mu4.
#'
#' The original formula and the formula of psych's tenberge() are different.
#' There is a high possibility that the original formula is incorrect and psych's
#' version is correct. According to Equation (4) of the original article, mu
#' should increase monotonically (e.g., mu4>=mu3), but if the original formula is
#' followed, it may decrease in some cases. The formula of the original paper is
#' 2h, but changing it to 2^h solves this problem. This function follow the latter
#' interpretation.
#' @author Eunseong Cho, \email{bene@kw.ac.kr}
#' @param data a dataframe or a matrix (unidimensional)
#' @export mu4
#' @references Ten Berge, J. M. F., & Zegers, F. E. (1978). A series of lower
#' bounds to the reliability of a test. Psychometrika, 43(4), 575-579.
#' @examples mu4(Graham1)

mu4 <- function(data) {
    m <- get_cov(data)
    n <- nrow(m)/(nrow(m) - 1)
    off <- m
    diag(off) <- 0
    numerator <- sum(off) + sqrt(sum(off^2) + sqrt(sum(off^4) + sqrt(sum(off^8) + sqrt(n * sum(off^16)))))
    mu4 <- numerator/sum(m)
    class(mu4) <- c("mu4")
    return(mu4)
}
eunscho/unirel documentation built on Dec. 20, 2021, 6:44 a.m.