library(readxl)
Fat_allo <- read_excel("C:/Users/Admin/Desktop/Fat_allo.xlsx", 
     sheet = "Pro_Energy", col_types = c("text", 
         "text", "numeric", "numeric"))
View(Fat_allo)
require(multcomp)
require(lsmeans)
require(ggpubr)
require(car)
attach(Fat_allo)
attach(Fat_allo)

Protein

Treatment=as.factor(Fat_allo$Treatment)
Compartment=as.factor(Fat_allo$Compartment)
plot=ggline(Fat_allo,x="Treatment",y="Allo_Pro",color="Compartment",add=c("mean_se","dotplot"),palette = c("black","brown","blue","red"))
plot

modelpro=lm(Allo_Pro~Treatment*Compartment,data = Fat_allo)
anova(modelpro)
## Analysis of Variance Table
## 
## Response: Allo_Pro
##                       Df  Sum Sq Mean Sq   F value Pr(>F)    
## Treatment              3 0.00000 0.00000    0.0026 0.9998    
## Compartment            3 3.02977 1.00992 2028.5760 <2e-16 ***
## Treatment:Compartment  9 0.00187 0.00021    0.4163 0.9168    
## Residuals             32 0.01593 0.00050                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
modelpro1=lm(Allo_Pro~Treatment+Compartment,data = Fat_allo)
anova(modelpro1)
## Analysis of Variance Table
## 
## Response: Allo_Pro
##             Df Sum Sq Mean Sq  F value Pr(>F)    
## Treatment    3 0.0000 0.00000    0.003 0.9998    
## Compartment  3 3.0298 1.00992 2326.710 <2e-16 ***
## Residuals   41 0.0178 0.00043                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
posthoc=lsmeans(modelpro1,pairwise~Treatment*Compartment,adjust="Tukey")
cld(posthoc[[1]],alpha=0.05,Letters=letters)
##  Treatment Compartment lsmean      SE df  lower.CL upper.CL .group
##  Control   Liver       0.0152 0.00796 41 -0.000865   0.0313  a    
##  High_carb Liver       0.0153 0.00796 41 -0.000731   0.0314  a    
##  Mixed     Liver       0.0155 0.00796 41 -0.000603   0.0315  a    
##  High_fat  Liver       0.0160 0.00796 41 -0.000111   0.0320  a    
##  Control   Viscera     0.0301 0.00796 41  0.014035   0.0462  a    
##  High_carb Viscera     0.0302 0.00796 41  0.014168   0.0463  a    
##  Mixed     Viscera     0.0304 0.00796 41  0.014296   0.0464  a    
##  High_fat  Viscera     0.0309 0.00796 41  0.014788   0.0469  a    
##  Control   Fillet      0.3909 0.00796 41  0.374841   0.4070   b   
##  High_carb Fillet      0.3910 0.00796 41  0.374974   0.4071   b   
##  Mixed     Fillet      0.3912 0.00796 41  0.375102   0.4072   b   
##  High_fat  Fillet      0.3917 0.00796 41  0.375594   0.4077   b   
##  Control   Remaining   0.6101 0.00796 41  0.594041   0.6262    c  
##  High_carb Remaining   0.6102 0.00796 41  0.594174   0.6263    c  
##  Mixed     Remaining   0.6104 0.00796 41  0.594302   0.6264    c  
##  High_fat  Remaining   0.6109 0.00796 41  0.594794   0.6269    c  
## 
## Confidence level used: 0.95 
## P value adjustment: tukey method for comparing a family of 16 estimates 
## significance level used: alpha = 0.05

Energy

plot=ggline(Fat_allo,x="Treatment",y="Allo_Energy",color="Compartment",add=c("mean_se","dotplot"),palette = c("black","brown","blue","red"))
plot
## `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.

modelener=lm(Allo_Energy~Treatment*Compartment,data = Fat_allo)
anova(modelener)
## Analysis of Variance Table
## 
## Response: Allo_Energy
##                       Df  Sum Sq Mean Sq   F value Pr(>F)    
## Treatment              3 0.00001 0.00000    0.0048 0.9995    
## Compartment            3 2.73483 0.91161 1374.2745 <2e-16 ***
## Treatment:Compartment  9 0.00556 0.00062    0.9313 0.5119    
## Residuals             32 0.02123 0.00066                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
modelener1=lm(Allo_Energy~Treatment+Compartment,data = Fat_allo)
anova(modelener1)
## Analysis of Variance Table
## 
## Response: Allo_Energy
##             Df  Sum Sq Mean Sq   F value Pr(>F)    
## Treatment    3 0.00001 0.00000    0.0049 0.9995    
## Compartment  3 2.73483 0.91161 1395.3059 <2e-16 ***
## Residuals   41 0.02679 0.00065                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
posthoc=lsmeans(modelener1,pairwise~Treatment*Compartment,adjust="Tukey")
cld(posthoc[[1]],alpha=0.05,Letters=letters)
##  Treatment Compartment lsmean      SE df lower.CL upper.CL .group
##  High_fat  Liver       0.0345 0.00976 41   0.0148   0.0543  a    
##  Mixed     Liver       0.0352 0.00976 41   0.0155   0.0549  a    
##  High_carb Liver       0.0356 0.00976 41   0.0158   0.0553  a    
##  Control   Liver       0.0357 0.00976 41   0.0160   0.0554  a    
##  High_fat  Viscera     0.0689 0.00976 41   0.0491   0.0886  a    
##  Mixed     Viscera     0.0695 0.00976 41   0.0498   0.0892  a    
##  High_carb Viscera     0.0699 0.00976 41   0.0502   0.0896  a    
##  Control   Viscera     0.0700 0.00976 41   0.0503   0.0897  a    
##  High_fat  Fillet      0.3089 0.00976 41   0.2892   0.3286   b   
##  Mixed     Fillet      0.3095 0.00976 41   0.2898   0.3292   b   
##  High_carb Fillet      0.3099 0.00976 41   0.2902   0.3296   b   
##  Control   Fillet      0.3100 0.00976 41   0.2903   0.3298   b   
##  High_fat  Remaining   0.6317 0.00976 41   0.6120   0.6514    c  
##  Mixed     Remaining   0.6323 0.00976 41   0.6126   0.6521    c  
##  High_carb Remaining   0.6327 0.00976 41   0.6130   0.6524    c  
##  Control   Remaining   0.6329 0.00976 41   0.6131   0.6526    c  
## 
## Confidence level used: 0.95 
## P value adjustment: tukey method for comparing a family of 16 estimates 
## significance level used: alpha = 0.05

Ash

library(readxl)
Fat_allo <- read_excel("C:/Users/Admin/Desktop/Fat_allo.xlsx", 
     sheet = "Fat_Ash", col_types = c("text", 
         "text", "numeric", "numeric"))
View(Fat_allo)
attach(Fat_allo)
Treatment=as.factor(Fat_allo$Treatment)
Compartment=as.factor(Fat_allo$Compartment)
plot=ggline(Fat_allo,x="Treatment",y="Allo_Ash",color="Compartment",add=c("mean_se","dotplot"),palette = c("black","blue","red"))
plot

modelash=lm(Allo_Ash~Treatment*Compartment,data = Fat_allo)
anova(modelash)
## Analysis of Variance Table
## 
## Response: Allo_Ash
##                       Df Sum Sq Mean Sq    F value Pr(>F)    
## Treatment              3 0.0001  0.0000     0.1239 0.9451    
## Compartment            2 9.4822  4.7411 12288.5719 <2e-16 ***
## Treatment:Compartment  6 0.0014  0.0002     0.5903 0.7348    
## Residuals             24 0.0093  0.0004                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
modelash1=lm(Allo_Ash~Treatment+Compartment,data = Fat_allo)
anova(modelash1)
## Analysis of Variance Table
## 
## Response: Allo_Ash
##             Df Sum Sq Mean Sq   F value Pr(>F)    
## Treatment    3 0.0001  0.0000     0.135 0.9384    
## Compartment  2 9.4822  4.7411 13385.282 <2e-16 ***
## Residuals   30 0.0106  0.0004                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
posthoc=lsmeans(modelash1,pairwise~Treatment*Compartment,adjust="Tukey")
cld(posthoc[[1]],alpha=0.05,Letters=letters)
##  Treatment Compartment  lsmean      SE df lower.CL upper.CL .group
##  Mixed     Viscera     0.00717 0.00768 30 -0.00852   0.0229  a    
##  High_carb Viscera     0.00809 0.00768 30 -0.00760   0.0238  a    
##  Control   Viscera     0.01029 0.00768 30 -0.00540   0.0260  a    
##  High_fat  Viscera     0.01231 0.00768 30 -0.00338   0.0280  a    
##  Mixed     Fillet      0.08261 0.00768 30  0.06692   0.0983   b   
##  High_carb Fillet      0.08354 0.00768 30  0.06785   0.0992   b   
##  Control   Fillet      0.08573 0.00768 30  0.07004   0.1014   b   
##  High_fat  Fillet      0.08776 0.00768 30  0.07207   0.1034   b   
##  Mixed     Remaining   1.13163 0.00768 30  1.11594   1.1473    c  
##  High_carb Remaining   1.13256 0.00768 30  1.11687   1.1483    c  
##  Control   Remaining   1.13475 0.00768 30  1.11906   1.1504    c  
##  High_fat  Remaining   1.13678 0.00768 30  1.12109   1.1525    c  
## 
## Confidence level used: 0.95 
## P value adjustment: tukey method for comparing a family of 12 estimates 
## significance level used: alpha = 0.05

Fat

plot=ggline(Fat_allo,x="Treatment",y="Allo_fat",color="Compartment",add=c("mean_se","dotplot"),palette = c("black","blue","red"))
plot
## `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.

modelfat=lm(Allo_fat~Treatment*Compartment,data = Fat_allo)
anova(modelfat)
## Analysis of Variance Table
## 
## Response: Allo_fat
##                       Df Sum Sq Mean Sq   F value    Pr(>F)    
## Treatment              3 0.0035 0.00116    0.6881    0.5682    
## Compartment            2 3.8675 1.93373 1149.0027 < 2.2e-16 ***
## Treatment:Compartment  6 0.1360 0.02267   13.4679 1.177e-06 ***
## Residuals             24 0.0404 0.00168                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
posthoc=lsmeans(modelfat,pairwise~Treatment*Compartment,adjust="Tukey")
cld(posthoc[[1]],alpha=0.05,Letters=letters)
##  Treatment Compartment lsmean     SE df lower.CL upper.CL .group
##  High_carb Fillet      0.0388 0.0237 24  -0.0101   0.0876  a    
##  Control   Fillet      0.0590 0.0237 24   0.0101   0.1078  a    
##  Mixed     Fillet      0.1115 0.0237 24   0.0626   0.1604  ab   
##  High_carb Viscera     0.1434 0.0237 24   0.0945   0.1923  ab   
##  High_fat  Viscera     0.1569 0.0237 24   0.1080   0.2058  ab   
##  High_fat  Fillet      0.1862 0.0237 24   0.1373   0.2351   b   
##  Mixed     Viscera     0.1883 0.0237 24   0.1394   0.2372   b   
##  Control   Viscera     0.1924 0.0237 24   0.1435   0.2413   b   
##  High_fat  Remaining   0.7205 0.0237 24   0.6716   0.7694    c  
##  Mixed     Remaining   0.7788 0.0237 24   0.7299   0.8277    cd 
##  Control   Remaining   0.8493 0.0237 24   0.8005   0.8982     de
##  High_carb Remaining   0.9597 0.0237 24   0.9108   1.0086      e
## 
## Confidence level used: 0.95 
## P value adjustment: tukey method for comparing a family of 12 estimates 
## significance level used: alpha = 0.05