Geoscience Reference
In-Depth Information
either the same result or a more extreme result from similar experiments in
which the null hypothesis is true would be 3,507 in 10,000.
h e second example demonstrates the handling of tied values in a data set
with a large sample size (>50 measurements). We create such a data set of
100 measurements by using a random number generator:
data1 = 3.4 + rand(1,100);
data2 = 4.3 + rand(1,100);
We then replace some values in data1 and data2 to introduce replicate (or
tied) values.
data1(1,50:55) = 2.5;
data2(1,25:28) = 2.5;
We i rst subtract the medians from both data sets as the method requires the
medians to be similar.
data1 = data1 - median(data1);
data2 = data2 - median(data2);
h e two samples are then concatenated horizontally and sorted in ascending
order by typing
data = horzcat(data1,data2);
data = sort(data);
For the Ansari-Bradley test we now use the function tiedrank with (data,0,1) ,
which computes the ranks from each end so that the smallest and largest
values are assigned rank 1, the next smallest and largest are assigned rank 2,
and so forth.
icf = tiedrank(data,0,1);
h en, we calculate the test statistic of the Ansari-Bradley test, which is the
sum of the ranks of those measurements that are members of data1 .
An = sum(icf(ismember(data,data1)))
which yields
An =
4903
Alternatively, we can again use the equation introduced above by typing
n1 = length(data1);
n2 = length(data2);
Search WWH ::




Custom Search