mirror of
https://github.com/MillironX/beefblup.git
synced 2024-12-22 09:08:16 +00:00
Solve the mixed-model equations
This commit is contained in:
parent
f2615b1048
commit
eb0ca76d19
1 changed files with 17 additions and 0 deletions
|
@ -164,3 +164,20 @@ for i = 1:numanimals
|
|||
continue
|
||||
|
||||
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;
|
Loading…
Reference in a new issue