Using Aids2
dataset from package MASS
, I am applying Ansari-Bradley Non-Parametric Test to test Group Independency by this snippets
library(coin)
library(MASS)
a1 <- ansari_test(Aids2$diag~Aids2$state)
a2 <- ansari_test(Aids2$diag~Aids2$sex)
if I take a peek of a1 and a2 object it gives summary like this:
Asymptotic K-Sample Ansari-Bradley Test
data: Aids2$diag by Aids2$state (NSW, Other, QLD, VIC)
chi-squared = 4.4829, df = 3, p-value = 0.2138
Asymptotic Two-Sample Ansari-Bradley Test
data: Aids2$diag by Aids2$sex (F, M)
Z = -1.6765, p-value = 0.09364
alternative hypothesis: true ratio of scales is not equal to 1
with the respective object class is:
> class(a1)
[1] "QuadTypeIndependenceTest"
attr(,"package")
[1] "coin"
> class(a2)
[1] "ScalarIndependenceTest"
attr(,"package")
[1] "coin"
However since I am only interested to the p-value (p-value = 0.2138), I would like only to extract that from the object, but I couldnt find how to extract it..