R/alpha.cronbach.r

alpha.cronbach = function(x){
	
	n = nrow(x) #n. of subject
	k = ncol(x) #n. of items

	var.cov.mat 	= cov(x) * (n-1)/n
	num 				= sum(diag(var.cov.mat))
	den 				= 2*sum(var.cov.mat[lower.tri(var.cov.mat)])+num
	alpha 			= k / (k-1) * (1 - num/den)
	return(alpha)
}

Try the CMC package in your browser

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

CMC documentation built on May 2, 2019, 2:10 p.m.