getwd()
## [1] "C:/Users/aluno/Documents"
setwd("C:/Users/aluno/Documents")
library(boot)
library(agricolae)
## Warning: package 'agricolae' was built under R version 3.1.3
dic=read.table("dic.txt", h=TRUE)
str(dic)
## 'data.frame': 20 obs. of 2 variables:
## $ niveis: Factor w/ 5 levels "T1","T2","T3",..: 1 1 1 1 2 2 2 2 3 3 ...
## $ y : num 4.6 5.1 5.8 5.5 6 7.1 7.2 6.8 5.8 7.2 ...
summary(dic)
## niveis y
## T1:4 Min. :4.600
## T2:4 1st Qu.:5.675
## T3:4 Median :5.950
## T4:4 Mean :6.120
## T5:4 3rd Qu.:6.800
## Max. :7.200
dic
## niveis y
## 1 T1 4.6
## 2 T1 5.1
## 3 T1 5.8
## 4 T1 5.5
## 5 T2 6.0
## 6 T2 7.1
## 7 T2 7.2
## 8 T2 6.8
## 9 T3 5.8
## 10 T3 7.2
## 11 T3 6.9
## 12 T3 6.7
## 13 T4 5.6
## 14 T4 4.9
## 15 T4 5.9
## 16 T4 5.7
## 17 T5 5.8
## 18 T5 6.4
## 19 T5 6.6
## 20 T5 6.8
boxplot(y ~ niveis, data=dic, col="red")
Analisando o bloxplot observa se que o tratamento T5 e T4 sĂŁo estatisticamente p
mod1<-aov(y~niveis,data=dic)
summary(mod1)
## Df Sum Sq Mean Sq F value Pr(>F)
## niveis 4 7.597 1.899 7.277 0.00183 **
## Residuals 15 3.915 0.261
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
library(agricolae)
library(boot)
library(doBy)
## Warning: package 'doBy' was built under R version 3.1.3
## Loading required package: survival
## Loading required package: splines
##
## Attaching package: 'survival'
##
## The following object is masked from 'package:boot':
##
## aml
summaryBy(y ~ niveis, data=dic, FUN = c(length, sd))
## niveis y.length y.sd
## 1 T1 4 0.5196152
## 2 T2 4 0.5439056
## 3 T3 4 0.6027714
## 4 T4 4 0.4349329
## 5 T5 4 0.4320494
names(mod1)
## [1] "coefficients" "residuals" "effects" "rank"
## [5] "fitted.values" "assign" "qr" "df.residual"
## [9] "contrasts" "xlevels" "call" "terms"
## [13] "model"
dic$y
## [1] 4.6 5.1 5.8 5.5 6.0 7.1 7.2 6.8 5.8 7.2 6.9 6.7 5.6 4.9 5.9 5.7 5.8
## [18] 6.4 6.6 6.8
cv.model(mod1)
## [1] 8.347738
par(mfrow = c(2,2))
plot(mod1)
shapiro.test(mod1$residuals)
##
## Shapiro-Wilk normality test
##
## data: mod1$residuals
## W = 0.8784, p-value = 0.01654
bartlett.test(y ~niveis, data = dic)
##
## Bartlett test of homogeneity of variances
##
## data: y by niveis
## Bartlett's K-squared = 0.4424, df = 4, p-value = 0.9789
LSD.test(mod1, "niveis", p.adj="bon", console=TRUE)
##
## Study: mod1 ~ "niveis"
##
## LSD t Test for y
## P value adjustment method: bonferroni
##
## Mean Square Error: 0.261
##
## niveis, means and individual ( 95 %) CI
##
## y std r LCL UCL Min Max
## T1 5.250 0.5196152 4 4.705541 5.794459 4.6 5.8
## T2 6.775 0.5439056 4 6.230541 7.319459 6.0 7.2
## T3 6.650 0.6027714 4 6.105541 7.194459 5.8 7.2
## T4 5.525 0.4349329 4 4.980541 6.069459 4.9 5.9
## T5 6.400 0.4320494 4 5.855541 6.944459 5.8 6.8
##
## alpha: 0.05 ; Df Error: 15
## Critical Value of t: 3.286039
##
## Least Significant Difference 1.187074
## Means with the same letter are not significantly different.
##
## Groups, Treatments and means
## a T2 6.775
## ab T3 6.65
## abc T5 6.4
## bc T4 5.525
## c T1 5.25
test1 = LSD.test(mod1, "niveis", p.adj="bon", console=TRUE)
##
## Study: mod1 ~ "niveis"
##
## LSD t Test for y
## P value adjustment method: bonferroni
##
## Mean Square Error: 0.261
##
## niveis, means and individual ( 95 %) CI
##
## y std r LCL UCL Min Max
## T1 5.250 0.5196152 4 4.705541 5.794459 4.6 5.8
## T2 6.775 0.5439056 4 6.230541 7.319459 6.0 7.2
## T3 6.650 0.6027714 4 6.105541 7.194459 5.8 7.2
## T4 5.525 0.4349329 4 4.980541 6.069459 4.9 5.9
## T5 6.400 0.4320494 4 5.855541 6.944459 5.8 6.8
##
## alpha: 0.05 ; Df Error: 15
## Critical Value of t: 3.286039
##
## Least Significant Difference 1.187074
## Means with the same letter are not significantly different.
##
## Groups, Treatments and means
## a T2 6.775
## ab T3 6.65
## abc T5 6.4
## bc T4 5.525
## c T1 5.25
bar.group(test1$group, ylim=c(0,30))
test2 = TukeyHSD(mod1)
test2
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = y ~ niveis, data = dic)
##
## $niveis
## diff lwr upr p adj
## T2-T1 1.525 0.40949396 2.640506042 0.0056636
## T3-T1 1.400 0.28449396 2.515506042 0.0110848
## T4-T1 0.275 -0.84050604 1.390506042 0.9378222
## T5-T1 1.150 0.03449396 2.265506042 0.0418184
## T3-T2 -0.125 -1.24050604 0.990506042 0.9965682
## T4-T2 -1.250 -2.36550604 -0.134493958 0.0247157
## T5-T2 -0.375 -1.49050604 0.740506042 0.8339632
## T4-T3 -1.125 -2.24050604 -0.009493958 0.0476084
## T5-T3 -0.250 -1.36550604 0.865506042 0.9551477
## T5-T4 0.875 -0.24050604 1.990506042 0.1626657
plot(test2)
teste3=HSD.test(mod1, "niveis", console=TRUE)
##
## Study: mod1 ~ "niveis"
##
## HSD Test for y
##
## Mean Square Error: 0.261
##
## niveis, means
##
## y std r Min Max
## T1 5.250 0.5196152 4 4.6 5.8
## T2 6.775 0.5439056 4 6.0 7.2
## T3 6.650 0.6027714 4 5.8 7.2
## T4 5.525 0.4349329 4 4.9 5.9
## T5 6.400 0.4320494 4 5.8 6.8
##
## alpha: 0.05 ; Df Error: 15
## Critical Value of Studentized Range: 4.366985
##
## Honestly Significant Difference: 1.115506
##
## Means with the same letter are not significantly different.
##
## Groups, Treatments and means
## a T2 6.775
## a T3 6.65
## ab T5 6.4
## bc T4 5.525
## c T1 5.25
bar.group(test1$group, ylim=c(0,30))