4.) The following data was collected on nitrate concentrations in two streams: S
ID: 3074464 • Letter: 4
Question
4.) The following data was collected on nitrate concentrations in two streams: Stream 1 15.42 13.57 9.49 13.95 16.77 21.17 6.80 7.34 15.93 Stream 2 13.68 13.68 13.18 14.0011.84 11.49 15.51 13.29 14.22 Use R to calculate: a) a t-test and b) Wilcoxon Rank Sum test. Show the R syntax and results for each procedure in your write-up. Additionally, interpret the results of each test. In your write-up describing and interpreting the results of each test, specify the value of each test statistic, the null-hypothesis tested by each statistic, whether or not you rejected the null-hypothesis, and what assumptions of the tests might not have been metExplanation / Answer
a.) t-test:
syntax:
y1 <- c(15.42, 13.57, 9.49, 13.95, 16.77, 21.17, 6.8, 7.34, 15.93)
y2 <- c(13.68, 13.68, 13.18, 14, 11.84, 11.49, 15.51, 13.29, 14.22)
t.test(y1,y2)
O/p:
data: y1 and y2
t = -0.030789,
df = 9.0531,
p-value = 0.9761
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-3.720408 3.620408
sample estimates:
mean of x mean of y
13.38222 13.43222
The above test checks for below Hypotheses:
Null: true difference in means of y1 and y2 is equal to 0
Alternate: true difference in means is not equal to 0
t-statistic: -0.03
Resulting in p-value: 0.97
Since p > 0.05 (at alpha = 0.05), We will reject the alternate Hypotheses
b.) Wilcoxon rank sum test:
syntax
y1 <- c(15.42, 13.57, 9.49, 13.95, 16.77, 21.17, 6.8, 7.34, 15.93)
y2 <- c(13.68, 13.68, 13.18, 14, 11.84, 11.49, 15.51, 13.29, 14.22)
wilcox.test(y1, y2, paired = FALSE, conf.level = 0.95, conf.int = TRUE, alternative = "two.sided", mu = 0)
output:
data: y1 and y2
W = 45,
p-value = 0.7238
alternative hypothesis: true location shift is not equal to 0
95 percent confidence interval:
-4.689963 3.090021
sample estimates:
difference in location
0.4199932
Warning messages:
1: In wilcox.test.default(y1, y2, paired = FALSE, conf.level = 0.95, :
cannot compute exact p-value with ties
The above test checks for below Hypotheses:
Null: true location shift is equal to 0
Alternate: true location shift is equal to 0
W = 45
Resulting in p-value: 0.72
Since p > 0.05 (at alpha = 0.05), We will reject the alternate Hypotheses
note that the "Warning" from wilcox.test was just that: a warning rather than an indication that your results are incorrect. The test was OK, reporting a p-value based on a normal approximation rather than an exact p-value based on the data values. If you had 50 or more cases, your call to wilcox.test would not even have tried to calculate exact p-values. The coin package in R has a wilcox_test function that can calculate exact p-values in the presence of ties, but I see no need here for an exact p-value.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.