source("prelude.R")
data_dir<-paste0(data_dir_path,"cytometry")
setwd(data_dir)
cyto<-read.table("Result-dev-mean", header=TRUE)
cyto$ID<-as.factor(cyto$ID)
cyto$Repbio<-as.factor(cyto$Repbio)
summary(cyto)
## ID Repbio Mean.sample SD.sample
## Adulte :3 repbio1:6 Min. : 440938 Min. : 0
## Juvenile:3 repbio2:6 1st Qu.: 16470955 1st Qu.: 1969068
## NF45-48 :3 repbio3:6 Median : 36698208 Median : 6728804
## NF51-54 :3 Mean :109120285 Mean :13664077
## NF56 :3 3rd Qu.: 98643000 3rd Qu.:13756304
## NF60-61 :3 Max. :843553242 Max. :67120009
## Mean.weight SD.weight
## Min. :5.049e+07 Min. : 0
## 1st Qu.:3.879e+08 1st Qu.: 32191228
## Median :1.870e+09 Median :235844967
## Mean :2.562e+09 Mean :214946458
## 3rd Qu.:3.154e+09 3rd Qu.:347835150
## Max. :1.164e+10 Max. :528920478
We want to know if the bacterial counts between samples of different developmental stages are identical. The null hypothesis is that the bacterial load during development remains constant, assuming that it follows a normal distribution.
kruskal.test(Mean.sample ~ ID, data = cyto)
##
## Kruskal-Wallis rank sum test
##
## data: Mean.sample by ID
## Kruskal-Wallis chi-squared = 14.614, df = 5, p-value = 0.01215
The p-value is 0.012, hence we can reject the null hypothesis at the 0.05 significance level. There is a significant effect of the developmental stage on the observed counts of bacteria.
reg.aov1<-lm(Mean.sample~ID,data=cyto)
anova(reg.aov1)
Using an anova we obtain a P-value of 0.041 , i.e. less than 5% . Thus we reject H0 and can conclude that there is a significant effect of the developmental stage at the 5% threshold. There is at least one developmental stage at which the bacterial load is significantly different from the others. We analysed the residuals to test the normality.
res.aov1 <-rstudent(reg.aov1)
summary(lm(Mean.sample~ID,data=cyto))
##
## Call:
## lm(formula = Mean.sample ~ ID, data = cyto)
##
## Residuals:
## Min 1Q Median 3Q Max
## -226413061 -20219432 -4106063 7222837 419016512
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 36252221 87729912 0.413 0.6867
## IDJuvenile -15319837 124068832 -0.123 0.9038
## IDNF45-48 -34773683 124068832 -0.280 0.7840
## IDNF51-54 18349068 124068832 0.148 0.8849
## IDNF56 388284509 124068832 3.130 0.0087 **
## IDNF60-61 80668328 124068832 0.650 0.5278
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.52e+08 on 12 degrees of freedom
## Multiple R-squared: 0.5793, Adjusted R-squared: 0.4041
## F-statistic: 3.305 on 5 and 12 DF, p-value: 0.04165
library(lattice)
monpanel <- function(...) {
panel.xyplot(...)
panel.abline(h=c(-2,0,2),lty=c(3,2,3),...
)
}
trellis.par.set(list(fontsize=list(point=5,text=8)))
xyplot(res.aov1~I(1:18)|ID,data=cyto,pch=15,panel=monpanel,ylab="Résidus",xlab="")
There is one residual value outside the interval [-2,2] ; that is 1/18 thus 5.5% This is acceptable since theoretically 95% of te residuals are in the interval. The number of bacteria at the stage NF56 is significantly different from the others. Here the exemple of the difference with the value for adults
aov.cyto<-aov(Mean.sample~ID,data=cyto)
tuk<- TukeyHSD(aov.cyto)
plot(tuk)
pairwise.t.test(cyto$Mean.sample,cyto$ID,p.adj="BH")
##
## Pairwise comparisons using t tests with pooled SD
##
## data: cyto$Mean.sample and cyto$ID
##
## Adulte Juvenile NF45-48 NF51-54 NF56
## Juvenile 0.904 - - - -
## NF45-48 0.904 0.904 - - -
## NF51-54 0.904 0.904 0.904 - -
## NF56 0.043 0.043 0.043 0.043 -
## NF60-61 0.904 0.904 0.904 0.904 0.087
##
## P value adjustment method: BH
Conclusion: We found that the bacterial load changed significantly during development (ANOVA P-value = 0.041). The difference between pre-feeding and pre-metamorphic tapoles was significant (Tukey adjusted P-value = 0.046). We also observed a tendancy for difference between pre-metamorphic tadpoles and Adults (Tukey adjusted P-value = 0.073); and between pre-metamorphic tadpoles and froglets (Tukey adjusted P-value = 0.060).