function z = MiAnova(y)

n = length(y(:,1));
k = length(y(1,:));

Suma2 = 0;
Suma = 0;

for ren = 1:n
    for col = 1:k
        Suma2 = Suma2 + y(ren, col)^2;
        Suma = Suma + y(ren, col);
        
    end;
end;

SST = Suma2 - Suma^2/n/k;
SSA = n*sum(mean(y).^2) - Suma^2/n/k;
SSE = SST - SSA;

v1 = k-1;
v2 = k*(n-1);

s1 = SSA/v1;
s2 = SSE/v2;

F = s1/s2;
alfa = 0.01;

Fc = Finv(1-alfa, v1, v2);


fprintf('---------------------------------------------------------------------\n');
fprintf('Analisis de Varianza\n');
fprintf('---------------------------------------------------------------------\n');
fprintf('Fuente de     Suma            Grados de      Cuadrado        F calc\n');
fprintf('Variacion     cuadrados       Libertad          medio         \n');
fprintf('---------------------------------------------------------------------\n');
fprintf('Regresion %13.2f  %13.f  %13.2f %13.2f\n', SSA, v1, s1, F);
fprintf('Error     %13.2f  %13.f  %13.2f \n', SSE, v2, s2);
fprintf('Total     %13.2f  %13.f  \n', SST, v1+v2);
fprintf('---------------------------------------------------------------------\n');
fprintf('Con (1-alfa) = %5.3f tenemos %13.2f > %13.2f\n', 1-alfa, F, Fc);


z = F;