close all
clear all
 disp('Selenium: Greybil-Deall and Schiller-Eberhardt Estimators')
 lw = 3; 
 set(0, 'DefaultAxesFontSize', 16);
 fs = 15;
 msize = 10;

lab1=[115.7, 113.5, 103.3, 119.1, 114.2, 107.3,  91.2, 104.4];
lab2=[108.6, 109.1, 107.2, 111.5, 100.6, 106.3, 105.9, 109.7,...
                                  111.1, 107.9, 107.9, 107.9]; 
lab3=[107.6, 107.26,109.7, 109.7, 108.5, 106.5, 110.2, 108.3,...
                    110.5, 108.5, 108.8, 110.1, 109.4, 112.4];
lab4=[118.7, 109.7, 114.7, 105.4, 113.9, 106.3, 104.8, 106.3];

m =[mean(lab1)  mean(lab2)  mean(lab3)  mean(lab4)];
s  = [std(lab1)  std(lab2)  std(lab3)  std(lab4)]; 
ni=[8 12 14 8]; k=length(m);

%Graybill-Deal Estimator
wei = ni./s.^2;                %weights
m_gd = sum(m .* wei)/sum(wei)  %108.8892

%Schiller-Eberhardt Estimator
z = sort(m);
sb2 = (z(k)-z(1))^2/12;
wei = 1./(s.^2./ni + sb2);     %weights
m_se = sum(m .* wei)/sum(wei)  %108.7703


