Geoscience Reference
In-Depth Information
again from Hedderich and Sachs (2012, page 463). h e null hypothesis can
be rejected if the absolute measured z -value is higher than the absolute
critical z -value, which depends on the signii cance level ʱ.
Our i rst example uses the Ansari-Bradley test to test whether two samples
data1 and data2 , each consisting of eight measurements, come from the same
distribution ( null hypothesis ), or from distributions with the same median
and shape but dif erent dispersions ( alternative hypothesis ). We i rst clear the
workspace and dei ne two samples.
clear
data1 = [7 14 22 36 40 48 49 52];
data2 = [3 5 6 10 17 18 20 39];
We next subtract the medians from both data sets as the method requires the
medians to be similar.
data1 = data1 - median(data1);
data2 = data2 - median(data2);
We then concatenate the two samples horizontally and sort the measurements
in ascending order by typing
data = horzcat(data1,data2);
data = sort(data)
which yields
data =
Columns 1 through 5
-31.0000 -24.0000 -16.0000 -10.5000 -8.5000
Columns 6 through 10
-7.5000 -3.5000 -2.0000 2.0000 3.5000
Columns 11 through 15
4.5000 6.5000 10.0000 11.0000 14.0000
Column 16
25.5000
We determine the sample sizes for data1 and data2 and then calculate the size
n of the concatenated samples.
n1 = length(data1);
n2 = length(data2);
n = n1 + n2;
We then determine the positions of the measurements in data1 and data2
within the concatenated and sorted vector data using ismember . h e function
ismember returns an array of the same size as data containing 1 (true) where
the elements of data1 are in data , or 0 (false) where they are not. We type
Search WWH ::




Custom Search