Matlab Question At the energy utilization of the larvae, the following data is u
ID: 3776857 • Letter: M
Question
Matlab Question
At the energy utilization of the larvae, the following data is used to determine a relationship between W and R. W is weight of larvae and R is oxygen consumption of larvae. Find the least-squares fit of a straight line, standard error and coefficient of determination. (R vs. W) For biological reasons, a relationship must exist between R and W as R = bW^a. Find the least-square fit of a straight line, standard error and coefficient of determination by using following linearization equation. (InR vs. InW) ln R = ln B +a ln W Plot data and both fitting lines in a same graph for comparison. Which method provides a better fitting equation?Explanation / Answer
Solution:
%Define values
n = 29;
sigmaWR = 192.2276;
sigmaW= 61.219;
sigmaR = 49.7;
sigmaWsq = 258.0468;
sigmaRsq = 154.2738;
%Define formula for constants
b1= ((n*sigmaWR) - (sigmaW*sigmaR))/((n*sigmaWsq)-(sigmaW.^2))
b0 = ((sigmaR/n) - (b1*(sigmaW)/n))
%Display equation
disp('Least squares equation ')
fprintf('R = %f+ %f*W',b0,b1)
%Define formulas
SSww = sigmaWsq - ((sigmaW).^2)/n;
SSrr = sigmaRsq - ((sigmaR).^2)/n;
SSwr = sigmaWR - ((sigmaW*sigmaR)/n);
SST = SSrr
SSR = (SSwr).^2 / SSww
%Compute SSE
SSE = SST - SSR
%Compute and display standard error estimate
disp('Standard error estimate')
Se = sqrt(SSE/(n-2))
Sample Output:
>> az1
b1 =
0.6778
b0 =
0.2829
Least squares equation
R = 0.282939+ 0.677809*W
SST =
69.0983
SSR =
59.1801
SSE =
9.9182
Standard error estimate
Se =
0.6061
>>