[R] cronbachs alpha - score.items(psych) vs reliability(Rcmdr)
William Revelle
lists at revelle.net
Wed Feb 4 05:03:03 CET 2009
Dear Andreas,
I agree with John that it is straight forward to just include your
own function to do what both Rcmdr and psych do for finding alpha.
psych does not have any function to do the alpha if deleted option,
mainly because I think alpha is not a particularly good (although
very popular) estimate of reliability and it is even worse when using
the delete one item option. The recent set of papers in
Psychometrika by Sitjsma, Bentler, Green and me (the latter three
commenting on the target paper by Sitjsma) discussing alpha
summarizes the problems.
In terms of ease of use you might look at the guttman function in
psych. Given a data matrix or correlation matrix, with all items
keyed in the same direction, it will find 6 different estimates of
reliability (finding standardized alpha). You might also want to
examine the score.items and cluster.cor functions.
The keys vector in score.items, cluster.cor, and score.alpha is meant
to allow you to score multiple scales at the same time (as well as
reverse key some items) and then find the item-whole correlation as
well as interscale correlations.
Following your suggestion, I will eventually add the drop out one
item option to score.alpha.
Bill
At 7:47 PM -0500 2/3/09, John Fox wrote:
>Dear Andreas,
>
>I don't know whether there's another comparable function, but reliability()
>from the Rcmdr package is very simple; here it is printed out (as you could
>have done simply by typing its name -- I added the assignment arrow):
>
>reliability <-
>function (S)
>{
> reliab <- function(S, R) {
> k <- dim(S)[1]
> ones <- rep(1, k)
> v <- as.vector(ones %*% S %*% ones)
> alpha <- (k/(k - 1)) * (1 - (1/v) * sum(diag(S)))
> rbar <- mean(R[lower.tri(R)])
> std.alpha <- k * rbar/(1 + (k - 1) * rbar)
> c(alpha = alpha, std.alpha = std.alpha)
> }
> result <- list()
> if ((!is.numeric(S)) || !is.matrix(S) || (nrow(S) != ncol(S)) ||
> any(abs(S - t(S)) > max(abs(S)) * 1e-10) || nrow(S) <
> 2)
> stop(gettextRcmdr("argument must be a square, symmetric, numeric
>covariance matrix"))
> k <- dim(S)[1]
> s <- sqrt(diag(S))
> R <- S/(s %o% s)
> rel <- reliab(S, R)
> result$alpha <- rel[1]
> result$st.alpha <- rel[2]
> if (k < 3) {
> warning(gettextRcmdr("there are fewer than 3 items in the scale"))
> return(invisible(NULL))
> }
> rel <- matrix(0, k, 3)
> for (i in 1:k) {
> rel[i, c(1, 2)] <- reliab(S[-i, -i], R[-i, -i])
> a <- rep(0, k)
> b <- rep(1, k)
> a[i] <- 1
> b[i] <- 0
> cov <- a %*% S %*% b
> var <- b %*% S %*% b
> rel[i, 3] <- cov/(sqrt(var * S[i, i]))
> }
> rownames(rel) <- rownames(S)
> colnames(rel) <- c("Alpha", "Std.Alpha", "r(item, total)")
> result$rel.matrix <- rel
> class(result) <- "reliability"
> result
>}
>
>As an alternative to loading the package, you could just put the function
>definition in a file -- editing out the calls to gettextRcmdr, which are for
>translation of the error messages -- and source() the file when you want to
>use it. You'll probably also want the print method (obtained by
>Rcmdr:::print.reliability):
>
>print.reliability <-
>function (x, digits = 4, ...)
>{
> cat(paste("Alpha reliability = ", round(x$alpha, digits),
> "\n"))
> cat(paste("Standardized alpha = ", round(x$st.alpha, digits),
> "\n"))
> cat("\nReliability deleting each item in turn:\n")
> print(round(x$rel.matrix, digits))
> invisible(x)
>}
>
>I hope this helps,
> John
>
>------------------------------
>John Fox, Professor
>Department of Sociology
>McMaster University
>Hamilton, Ontario, Canada
>web: socserv.mcmaster.ca/jfox
>
>
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
>On
>> Behalf Of achristoffersen
>> Sent: February-03-09 6:47 PM
> > To: r-help at r-project.org
>> Subject: [R] cronbachs alpha - score.items(psych) vs reliability(Rcmdr)
>>
>>
>> Dear all,
>>
>> I like the way the Rcmdr package computes reliability. E.g
>>
>> reliability(cov(d[,c("q1", "q2", "q3", "q4", "q5", "q6")],
>> use="complete.obs"))
>>
>> will not only give me the alpha score, but also for each variable,
>> alpha.score if deleted. However - when writing scripts it's very tiresome
>to
>> load the whole Rcmdr GUI just for this purpose. So I'm looking for an
>> another package that delivers the same feature.
>>
>> the score.items function in the psych package i find is too complicated
>(it
>> requires a keys vector) and it doesn't report the "alpha if deleted"
>score.
>>
>> What have I missed when googling for an alternative?
>>
>> Thx in advance
>>
>> Andreas
>> --
>> View this message in context: http://www.nabble.com/cronbachs-alpha---
>> score.items%28psych%29-vs-reliability%28Rcmdr%29-tp21821595p21821595.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
--
William Revelle http://personality-project.org/revelle.html
Professor http://personality-project.org/personality.html
Department of Psychology http://www.wcas.northwestern.edu/psych/
Northwestern University http://www.northwestern.edu/
Attend ISSID/ARP:2009 http://issid.org/issid.2009/
More information about the R-help
mailing list