1
0
Fork 0
mirror of https://github.com/MillironX/beefblup.git synced 2024-12-22 17:08:16 +00:00

Solve the mixed-model equations

This commit is contained in:
Thomas A. Christensen II 2018-09-21 16:48:43 -06:00
parent f2615b1048
commit eb0ca76d19

View file

@ -164,3 +164,20 @@ for i = 1:numanimals
continue continue
end end
% Extract the observed data
Y = data{:, 5};
% The identity matrix for random effects
Z = speye(numanimals, numanimals);
% Prompt for heritablity
h2 = str2double(input('What is the heritablity for this trait? >> '));
lambda = (1-h2)/h2;
% Use the mixed-model equations
solutions = [X'*X X'*Z; Z'*X (Z'*Z)+(inv(A).*lambda)]\[X'*Y; Z'*Y];
% Find the accuracies
diaginv = diag(inv([X'*X X'*Z; Z'*X (Z'*Z)+(inv(A).*lambda)]));
reliability = 1 - diaginv.*lambda;