
k=4;  alpha = 0.05; 
ni=[12 24 48 96];
si2=[1 4 9 16];
alphai=[1   0 0 -1];
sai2=sum(alphai.^2); %effect = 2
wei=ni./si2;  recwei=1./wei;
nwei=wei/sum(wei)  %0.4091   0.2045   0.1818   0.2045
Q=sum( (1-nwei).^2./(ni-1)) %0.0802
df = (k^2-1)/(3 * Q)  %62.3773
lambda = sai2/mean(recwei) %13.2414
%the effect in units of an average of
%variances for the group means
pow = 1-ncfcdf( finv(1-alpha, k-1,df), k-1, df, lambda)  %0.8542
