From eb20b8b5526a2a314c67dc1cbb43bfa0b150c847 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Fri, 21 Sep 2018 20:34:36 -0600 Subject: [PATCH] Fix solving the mized model equation --- MATLAB/beefblup.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MATLAB/beefblup.m b/MATLAB/beefblup.m index b488e4c..32be92c 100644 --- a/MATLAB/beefblup.m +++ b/MATLAB/beefblup.m @@ -121,7 +121,7 @@ for i = 1:length(normal) end % Create an empty matrix for the additive relationship matrix -A = sparse(numanimals, numanimals); +A = zeros(numanimals, numanimals); % Create lambdas to find sire and dam of each animal dam = @(id) [data{animalrow(num2str(id)), 3}]; @@ -166,13 +166,13 @@ for i = 1:numanimals end % Extract the observed data -Y = data{:, 5}; +Y = cell2mat(data(:, 5)); % The identity matrix for random effects -Z = speye(numanimals, numanimals); +Z = eye(numanimals, numanimals); % Prompt for heritablity -h2 = str2double(input('What is the heritablity for this trait? >> ')); +h2 = input('What is the heritablity for this trait? >> '); lambda = (1-h2)/h2; % Use the mixed-model equations