Information Technology Reference
In-Depth Information
The large
p
-value forces you to conclude that there is no difference between the groups.
Contrast that result with the one from analyzing the same data, but correctly identifying
it as paired:
>
t.test(x, y, paired=TRUE)
Paired t-test
data: x and y
t = -2.3636, df = 99, p-value = 0.02005
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.4702824 -0.0410375
sample estimates:
mean of the differences
-0.2556599
The
p
-value plummets to 0.02005, and we reach exactly the opposite conclusion.
See Also
If the populations are not normally distributed (bell-shaped) and either sample is small,
the
t
test is inappropriate. In that case, consider using the Wilcoxon-Mann-Whitney
test, which is implemented by the
wilcox.test
function.
1.15 Testing a Correlation for Significance
Problem
You calculated the correlation between two variables, but you don't know if the cor-
relation is statistically significant.
Solution
The
cor.test
function can calculate both the
p
-value and the confidence interval of the
correlation. If the variables came from normally distributed populations, use the default
measure of correlation, known as the Pearson method:
>
cor.test(x, y)
For nonnormal populations, use the Spearman method instead:
>
cor.test(x, y, method="Spearman")
The function returns several values, including the
p
-value from the test of significance.
Conventionally,
p
< 0.05 indicates that the correlation is likely significant, whereas
p
> 0.05 indicates it is not.