In: Statistics and Probability
[R code]
A <- c(117.1, 121.3, 127.8, 121.9, 117.4, 124.5, 119.5,
115.1)
B <- c(123.5, 125.3, 126.5, 127.9, 122.1, 125.6, 129.8,
117.2)
I want to test whether Machine B makes more precise measurements
than Machine A. Adjust the center locations of the samples to be
equal using the median values of the two samples, and then
test(Ansari-Bardley test) at a significance level of 0.05. Thank
you :)
Solution
A <- c(117.1, 121.3, 127.8, 121.9, 117.4, 124.5, 119.5,
115.1)
> B <- c(123.5, 125.3, 126.5, 127.9, 122.1, 125.6, 129.8,
117.2)
> test=ansari.test(A, B,alternative="greater",exact = NULL,
conf.int = FALSE, conf.level = 0.95)
> test
Ansari-Bradley test
data: A and B
AB = 35, p-value = 0.4587
alternative hypothesis: true ratio of scales is greater than 1
Since p-value > 0.05 we conclude that variance are equal for both mmachine.
# We will use Wilcoxon rank sum test or Mann Whitnney U test to check test whether Machine B makes more precise measurements than Machine A based on median.
wilcox.test(A,B,alternative = "greater")
Wilcoxon rank sum test
data: A and B
W = 13, p-value = 0.981
alternative hypothesis: true location shift is greater than 0
Since p-value = 0.981 > 0.05 so we conclude that Machine B and Machine A same in precise measurement.