library(readxl)
Snakehead_compartments_agreed <- read_excel("C:/Users/Admin/Desktop/Luan van Offical/Snakehead compartments agreed.xlsx", 
     sheet = "Linear", col_types = c("text", 
         "numeric", "numeric", "numeric", 
         "numeric", "numeric", "numeric", 
         "numeric", "numeric", "numeric", 
         "numeric", "numeric"))
View(Snakehead_compartments_agreed)
attach(Snakehead_compartments_agreed)
require(ggplot2)
require(car)
require(psych)
require(relaimpo)

Fat diet vs fat_fillet

Linear1=lm(Diet_fat~Fillet_fat)
summary(Linear1)
## 
## Call:
## lm(formula = Diet_fat ~ Fillet_fat)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.7983 -2.3627  0.4066  1.3204  4.4531 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   3.0650     1.4841   2.065   0.0658 .  
## Fillet_fat    0.9122     0.1290   7.071 3.41e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.656 on 10 degrees of freedom
## Multiple R-squared:  0.8333, Adjusted R-squared:  0.8167 
## F-statistic:    50 on 1 and 10 DF,  p-value: 3.411e-05
p1=ggplot(Snakehead_compartments_agreed,aes(x=Diet_fat,y=Fillet_fat))
p1+geom_point()+theme_bw()+theme_classic()+geom_smooth(method="lm",formula= y~x)

Fat diet vs Pro_fillet

Linear2=lm(Diet_fat~Fillet_pro)
summary(Linear2)
## 
## Call:
## lm(formula = Diet_fat ~ Fillet_pro)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -8.6876 -4.6602  0.1294  3.6532 10.1197 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  39.9835    29.5659   1.352    0.206
## Fillet_pro   -0.7328     0.7742  -0.947    0.366
## 
## Residual standard error: 6.234 on 10 degrees of freedom
## Multiple R-squared:  0.08223,    Adjusted R-squared:  -0.00955 
## F-statistic: 0.8959 on 1 and 10 DF,  p-value: 0.3662
p2=ggplot(Snakehead_compartments_agreed,aes(x=Diet_fat,y=Fillet_pro))
p2+geom_point()+theme_bw()+theme_classic()+geom_smooth(method="lm",formula= y~x)

Fat diet vs Viscera

Linear3=lm(Diet_fat~Body_viscera)
summary(Linear3)
## 
## Call:
## lm(formula = Diet_fat ~ Body_viscera)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -6.648 -3.234 -2.235  4.302  9.688 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)   -12.228     13.622  -0.898    0.390
## Body_viscera    6.047      3.368   1.795    0.103
## 
## Residual standard error: 5.659 on 10 degrees of freedom
## Multiple R-squared:  0.2437, Adjusted R-squared:  0.1681 
## F-statistic: 3.223 on 1 and 10 DF,  p-value: 0.1029
p3=ggplot(Snakehead_compartments_agreed,aes(x=Diet_fat,y=Body_viscera))
p3+geom_point()+theme_bw()+theme_classic()+geom_smooth(method="lm",formula= y~x)

Protein diet vs Protein_fillet

Linear4=lm(Diet_pro~Fillet_pro)
summary(Linear4)
## 
## Call:
## lm(formula = Diet_pro ~ Fillet_pro)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -6.474 -5.205 -1.049  4.421  9.200 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  12.2619    29.9906   0.409    0.691
## Fillet_pro    0.8300     0.7853   1.057    0.315
## 
## Residual standard error: 6.323 on 10 degrees of freedom
## Multiple R-squared:  0.1005, Adjusted R-squared:  0.01053 
## F-statistic: 1.117 on 1 and 10 DF,  p-value: 0.3154
p4=ggplot(Snakehead_compartments_agreed,aes(x=Diet_pro,y=Fillet_pro))
p4+geom_point()+theme_bw()+theme_classic()+geom_smooth(method="lm",formula= y~x)

Protein diet vs Protein_Viscera

Linear5=lm(Diet_pro~Vis_pro)
summary(Linear5)
## 
## Call:
## lm(formula = Diet_pro ~ Vis_pro)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5.1937 -3.8235 -0.8704  2.5047 10.8466 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    83.53      14.54   5.747 0.000186 ***
## Vis_pro       -13.04       4.76  -2.740 0.020829 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 5.039 on 10 degrees of freedom
## Multiple R-squared:  0.4288, Adjusted R-squared:  0.3717 
## F-statistic: 7.508 on 1 and 10 DF,  p-value: 0.02083
p5=ggplot(Snakehead_compartments_agreed,aes(x=Diet_pro,y=Vis_pro))
p5+geom_point()+theme_bw()+theme_classic()+geom_smooth(method="lm",formula= y~x)

Energy diet vs Energy_fillet

Linear6=lm(Diet_ene~Energy_fillet)
summary(Linear6)
## 
## Call:
## lm(formula = Diet_ene ~ Energy_fillet)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.0109 -1.1264  0.3336  0.9046  2.1042 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    27.6376     4.9878   5.541 0.000247 ***
## Energy_fillet  -0.2573     0.1633  -1.576 0.146023    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.374 on 10 degrees of freedom
## Multiple R-squared:  0.199,  Adjusted R-squared:  0.1189 
## F-statistic: 2.485 on 1 and 10 DF,  p-value: 0.146
p6=ggplot(Snakehead_compartments_agreed,aes(x=Diet_ene,y=Energy_fillet))
p6+geom_point()+theme_bw()+theme_classic()+geom_smooth(method="lm",formula= y~x)

Energy diet vs Energy_vis+liver

Linear7=lm(Diet_ene~`Energy liver+vis`)
summary(Linear7)
## 
## Call:
## lm(formula = Diet_ene ~ `Energy liver+vis`)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.27230 -0.61624 -0.08864  0.25581  1.98617 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         14.1760     1.4942   9.487 2.57e-06 ***
## `Energy liver+vis`   0.5369     0.1401   3.833   0.0033 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9773 on 10 degrees of freedom
## Multiple R-squared:  0.595,  Adjusted R-squared:  0.5545 
## F-statistic: 14.69 on 1 and 10 DF,  p-value: 0.003304
p7=ggplot(Snakehead_compartments_agreed,aes(x=Diet_ene,y=`Energy liver+vis`))
p7+geom_point()+theme_bw()+theme_classic()+geom_smooth(method="lm",formula= y~x)