aflatoxin = read.csv("aflatoxin.csv")
print(aflatoxin)
## bac.COUNT location veg.sample bac.TYPE
## 1 82000 Ajilosun Carrot Salmonella
## 2 0 Ajilosun Cucumber Salmonella
## 3 0 Ajilosun Cabbage Salmonella
## 4 0 Ajilosun Garden.egg Salmonella
## 5 73000 Adebayo Carrot Salmonella
## 6 1000 Adebayo Cucumber Salmonella
## 7 34000 Adebayo Cabbage Salmonella
## 8 1000 Adebayo Garden.egg Salmonella
## 9 0 Basiri Carrot Salmonella
## 10 0 Basiri Cucumber Salmonella
## 11 4300 Basiri Cabbage Salmonella
## 12 0 Basiri Garden.egg Salmonella
## 13 0 Poly.road Carrot Salmonella
## 14 2000 Poly.road Cucumber Salmonella
## 15 25000 Poly.road Cabbage Salmonella
## 16 21000 Poly.road Garden.egg Salmonella
## 17 21000 Ajilosun Carrot Shigella
## 18 63000 Ajilosun Cucumber Shigella
## 19 148000 Ajilosun Cabbage Shigella
## 20 20000 Ajilosun Garden.egg Shigella
## 21 0 Adebayo Carrot Shigella
## 22 650000 Adebayo Cucumber Shigella
## 23 7000 Adebayo Cabbage Shigella
## 24 64000 Adebayo Garden.egg Shigella
## 25 83000 Basiri Carrot Shigella
## 26 0 Basiri Cucumber Shigella
## 27 27000 Basiri Cabbage Shigella
## 28 23000 Basiri Garden.egg Shigella
## 29 49000 Poly.road Carrot Shigella
## 30 35000 Poly.road Cucumber Shigella
## 31 29000 Poly.road Cabbage Shigella
## 32 13000 Poly.road Garden.egg Shigella
## 33 80000 Ajilosun Carrot Coliform
## 34 50000 Ajilosun Cucumber Coliform
## 35 42000 Ajilosun Cabbage Coliform
## 36 57000 Ajilosun Garden.egg Coliform
## 37 130000 Adebayo Carrot Coliform
## 38 30000 Adebayo Cucumber Coliform
## 39 100000 Adebayo Cabbage Coliform
## 40 50000 Adebayo Garden.egg Coliform
## 41 88000 Basiri Carrot Coliform
## 42 276000 Basiri Cucumber Coliform
## 43 240000 Basiri Cabbage Coliform
## 44 307000 Basiri Garden.egg Coliform
## 45 83000 Poly.road Carrot Coliform
## 46 50000 Poly.road Cucumber Coliform
## 47 224000 Poly.road Cabbage Coliform
## 48 55000 Poly.road Garden.egg Coliform
attach(aflatoxin)
modelA=lm(bac.COUNT~location + veg.sample + bac.TYPE, data=aflatoxin)
summary(modelA)
##
## Call:
## lm(formula = bac.COUNT ~ location + veg.sample + bac.TYPE, data = aflatoxin)
##
## Residuals:
## Min 1Q Median 3Q Max
## -138737 -49452 -19444 8003 520637
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 145679 47541 3.064 0.00395 **
## locationAjilosun -48083 44822 -1.073 0.28997
## locationBasiri -7642 44822 -0.170 0.86551
## locationPoly.road -46167 44822 -1.030 0.30936
## veg.sampleCarrot -15942 44822 -0.356 0.72401
## veg.sampleCucumber 23058 44822 0.514 0.60985
## veg.sampleGarden.egg -22442 44822 -0.501 0.61941
## bac.TYPESalmonella -101169 38817 -2.606 0.01290 *
## bac.TYPEShigella -39375 38817 -1.014 0.31666
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 109800 on 39 degrees of freedom
## Multiple R-squared: 0.2045, Adjusted R-squared: 0.04134
## F-statistic: 1.253 on 8 and 39 DF, p-value: 0.2955
anova(modelA)
## Analysis of Variance Table
##
## Response: bac.COUNT
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 2.2875e+10 7.6251e+09 0.6326 0.59845
## veg.sample 3 1.4769e+10 4.9230e+09 0.4084 0.74783
## bac.TYPE 2 8.3221e+10 4.1611e+10 3.4519 0.04166 *
## Residuals 39 4.7012e+11 1.2054e+10
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
library(gplots)
##
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
##
## lowess
plotmeans(bac.COUNT~location + location, frame = TRUE, mean.labels = TRUE, )
## Warning in text.default(x, y, label = labels, col = col, ...): "frame" is not a
## graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
## graphical parameter
## Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
## a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
## graphical parameter
It can easily been seen from the plot that the highest mean of aflatoxin come from Adebayo when considering location
plotmeans(bac.COUNT~veg.sample + veg.sample, frame = TRUE, mean.labels = TRUE)
## Warning in text.default(x, y, label = labels, col = col, ...): "frame" is not a
## graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
## graphical parameter
## Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
## a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
## graphical parameter
Under the type of bacteria, Coliform has the highest mean of aflatoxin, while Salmonella has the lowest count
Comment
It can also been seen from the plot that the highest mean of aflatoxin come from Cucumber when considering Vegetable samples