R/cronbach_alpha.R

Defines functions cronbach_alpha

## File Name: cronbach_alpha.R
## File Version: 0.01


# unstandardized estimate of Cronbach's alpha
cronbach_alpha <- function( dat.scale )
{
    I <- ncol( dat.scale )
    var.scale <- stats::var( dat.scale, use="pairwise.complete.obs" )
    v.bar <- mean( diag( var.scale )  )
    c.bar <- mean( var.scale[ upper.tri( var.scale ) ] )
    alpha <- ( I * c.bar ) / ( v.bar + (I-1) * c.bar )
    return(alpha)
}

Try the miceadds package in your browser

Any scripts or data that you put into this service are public.

miceadds documentation built on May 29, 2024, 11:05 a.m.