function [effects] = effects(d)
% gm = grandmean
gm = matmean(d);
effects= zeros(4,3);
% effects for A
for i =1:3
    m=matmean(d(i,:,:,:));
    effects(1,i) = m - gm;
end
% effects for D
for i =1:3
    m=matmean(d(:,i,:,:));
    effects(2,i) = m - gm;
end
% effects for P
for i =1:3
    m=matmean(d(:,:,i,:));
    effects(3,i) = m - gm;
end
% effects for M
for i =1:3
    m=matmean(d(:,:,:,i));
    effects(4,i) = m - gm;
end
