Prof. Lorenzo Zanette - l.zanette@ufc.br
Testes clássicos
Comparando as médias de dois conjuntos
Dados : “transectos.txt”
## trans1 trans2
## 1 3 5
## 2 4 5
## 3 4 6
## 4 3 7
## 5 2 4
## 6 3 4
##
## Welch Two Sample t-test
##
## data: transects[1] and transects[2]
## t = -3.873, df = 18, p-value = 0.001115
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -3.0849115 -0.9150885
## sample estimates:
## mean of x mean of y
## 3 5
## Warning in wilcox.test.default(transects$trans1, transects$trans2): cannot
## compute exact p-value with ties
##
## Wilcoxon rank sum test with continuity correction
##
## data: transects$trans1 and transects$trans2
## W = 11, p-value = 0.002988
## alternative hypothesis: true location shift is not equal to 0
Um pouco mais conservador…
Correlações
## x y f
## 1 1 3 a
## 2 2 4 a
## 3 3 2 a
## 4 4 1 a
## 5 5 3 a
## 6 6 1 a
No entanto…
## [1] "x" "y" "f"
## peso idade
## 1 3.179297 1
## 2 9.142903 7
## 3 6.414290 4
## 4 13.461561 11
## 5 4.795761 2
## 6 20.908349 18
> Quanto covariam as variáveis?
## [1] 35.04179
Quanto isso representa em termos de variação
## [1] 1229.921
# Finalmente o coeficiente de correlação
CC<- var(aves$peso,aves$idade) /sqrt(var(aves$peso)*var(aves$idade))
CC## [1] 0.999189
## [1] 0.999189
##
## Pearson's product-moment correlation
##
## data: aves$peso and aves$idade
## t = 119.01, df = 23, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9981303 0.9996483
## sample estimates:
## cor
## 0.999189