#Rsolução do exemplo 1 Aula de EAD 09/11
od <- c(1.2, 1.4, 1.4, 1.3, 1.2, 1.35, 1.4, 2.0, 1.95, 1.1, 1.75, 1.05, 1.05, 1.4)
od
## [1] 1.20 1.40 1.40 1.30 1.20 1.35 1.40 2.00 1.95 1.10 1.75 1.05 1.05 1.40
str(od)
## num [1:14] 1.2 1.4 1.4 1.3 1.2 1.35 1.4 2 1.95 1.1 ...
summary(od)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.050 1.200 1.375 1.396 1.400 2.000
sort(od)
## [1] 1.05 1.05 1.10 1.20 1.20 1.30 1.35 1.40 1.40 1.40 1.40 1.75 1.95 2.00
boxplot(od-1.2, col="lightgrey", ylab = "Oxigênio Dossilvido mg/l")
shapiro.test(od - 1.2)
##
## Shapiro-Wilk normality test
##
## data: od - 1.2
## W = 0.86929, p-value = 0.041
# Diferença observada
mean(od) - 1.2
## [1] 0.1964286
#com alpha = 5%
t.test(od - 1.2, alternative = c("two.sided"), mu = 0, conf.level = 0.95)
##
## One Sample t-test
##
## data: od - 1.2
## t = 2.4068, df = 13, p-value = 0.03168
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 0.02010878 0.37274836
## sample estimates:
## mean of x
## 0.1964286
As evidências do boxplot e do teste de Shapiro-wilks indicam que os dados não tem distribuição aproximadamente normal. Entretanto, como exercício, iremos utilizar o teste e o intervalo de confiança baseado na distribuição t para responder, inicialmente, a questão.
wilcox.test(od - 1.2, mu = 0, conf.int = TRUE)
##
## Wilcoxon signed rank test with continuity correction
##
## data: od - 1.2
## V = 70, p-value = 0.01627
## alternative hypothesis: true location is not equal to 0
## 95 percent confidence interval:
## 0.0249788 0.4749679
## sample estimates:
## (pseudo)median
## 0.1999742
t.test(x, y = NULL,
alternative = c ("two.sided", "less"","greater"),
mu = 0,
paired = FALSE,
var.equal = FALSE,
conf.level = 0.95, ...)