knor<-read.table("krill.txt",header=TRUE) head(knor) par(mfrow=c(2,2)) plot(knor$wwt_grams,knor$ulO2_min,ylab="Oxygen consumption (ul/min)",xlab="Wet weight(grams)") plot(log10(knor$wwt_grams),log10(knor$ulO2_min),ylab="log(Oxygen consumption (ul/min))",xlab="log(Wet weight(grams))") par(mfrow=c(2,2)) model<-lm(log(knor$ulO2_min) ~ poly(log(knor$wwt_grams,3))) plot(model) ## A few points at either end tail off giving a sigmoidal overall shape which usually mean your data have more extreme values than would be expected if they truly came from a Normal distribution. summary(model) #Call: #lm(formula = log(knor$ulO2_min) ~ poly(log(knor$wwt_grams, 3))) # #Residuals: # Min 1Q Median 3Q Max #-0.82340 -0.20866 0.01216 0.23879 0.62782 # #Coefficients: # Estimate Std. Error t value Pr(>|t|) #(Intercept) 3.71643 0.02825 131.56 <2e-16 *** #poly(log(knor$wwt_grams, 3)) 9.22200 0.33544 27.49 <2e-16 *** #--- #Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 # #Residual standard error: 0.3354 on 139 degrees of freedom #Multiple R-squared: 0.8447, Adjusted R-squared: 0.8435 #F-statistic: 755.8 on 1 and 139 DF, p-value: < 2.2e-16 ## Not surprisingly there is a highly significant relationship. However inspection of the original log-log plot shows a slight curvature. Since features such as respiration of aquatic organisms may scale with XXX we might expect that square root or cube root of mass could be involved. Therefore we will apply a polynomial regression. model3I<-lm(log(knor$ulO2_min) ~ knor$wwt_grams +I(knor$wwt_grams^2)+ I(knor$wwt_grams^3)) modelpoly3<-lm(log(knor$ulO2_min) ~ poly(log(knor$wwt_grams),3)) summary(modelpoly3) #Call: #lm(formula = log(knor$ulO2_min) ~ poly(log(knor$wwt_grams), 3)) # #Residuals: # Min 1Q Median 3Q Max #-0.79567 -0.17519 0.02326 0.24278 0.66977 # #Coefficients: # Estimate Std. Error t value Pr(>|t|) #(Intercept) 3.71643 0.02678 138.761 < 2e-16 *** #poly(log(knor$wwt_grams), 3)1 9.22200 0.31803 28.997 < 2e-16 *** #poly(log(knor$wwt_grams), 3)2 0.88492 0.31803 2.783 0.00616 ** #poly(log(knor$wwt_grams), 3)3 -1.00048 0.31803 -3.146 0.00203 ** #--- #Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 # #Residual standard error: 0.318 on 137 degrees of freedom #Multiple R-squared: 0.8624, Adjusted R-squared: 0.8594 #F-statistic: 286.2 on 3 and 137 DF, p-value: < 2.2e-16 ########## model2<-lm(log(knor$ulO2_min) ~ poly(log(knor$wwt_grams),2)) anova(modelpoly2,modelpoly3) Analysis of Variance Table Model 1: log(knor$ulO2_min) ~ poly(log(knor$wwt_grams), 2) Model 2: log(knor$ulO2_min) ~ poly(log(knor$wwt_grams), 3) Res.Df RSS Df Sum of Sq F Pr(>F) 1 138 14.857 2 137 13.857 1 1.001 9.8966 0.002031 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1