Robust estimation of Cronbach's alpha

The following programs can be used to compute the Cronbach's alpha coefficient based on the robust RMCD estimator using
S-PLUS and SAS (no warranty).
Andreas Christmann, University of Dortmund, Germany
Stefan van Aelst, University of Ghent, Belgium
17/June/2002

S-PLUS function (Version 4.5)

"CRalpha.RMCD" <- function(x,h=0.75) {
   n <- nrow(x)
   s <- cov.mcd(x,quan=floor(h*n),print=f)$cov
   p <- dim(s)[1]
   cralpha <- (p/(p - 1)) * (1 - sum(diag(s))/sum(s))
   return(cralpha)
}
### example
x <- matrix(rt(500,3), ncol=5)
CRalpha.RMCD(x)

SAS/IML module (Version 8.2)

PROC IML;
  START robcron(y);
    h=0.75; p=ncol(y); optn = j(8,1,.); optn[1]= 0; optn[2]= 1;
    optn[3]=2; optn[4]=floor(nrow(y)*h);
    CALL MCD(sc, coef, dist, optn, y); RMCD=coef[3:(2+p),];
    CRalpha=(p/(p-1)) * (1-sum(diag(RMCD))/sum(RMCD));
    return(CRalpha);
  FINISH;
  *** Example;
  SEED=31415; y=NORMAL(J(100,5,SEED));
  result=robcron(y); print result;
  

SAS-Macro (Version 8.2)

%MACRO robcron(datset, vars, h=0.75);
PROC IML;
    USE &datset; READ ALL VAR {&vars} INTO y; CLOSE &datset;
    h=&h; p=ncol(y); optn = j(8,1,.); optn[1]= 2; optn[2]= 1;
    optn[3]= 2; optn[4]=floor(nrow(y)*h);
    CALL MCD(sc, coef, dist, optn, y); RMCD=coef[3:(2+p),];
    CRalpha=(p/(p-1)) * (1-sum(diag(RMCD))/sum(RMCD)); print CRalpha;
QUIT; RUN;
%MEND;
*** Example;
DATA a; SEED=31415;
DO i=1 TO 100;
  x1=RANNOR(seed); x2=RANNOR(seed); x3=RANNOR(seed);
  x4=RANNOR(seed); x5=RANNOR(seed); OUTPUT;
END; KEEP x1 - x5; RUN;
%robcron(a,x1 x2 x3 x4 x5);

Email: Andreas Christmann  17/June/2002