%% Example of how stochastic_dominance_test.m is used by generating random data and running the test
% Alter the inputs of x = () or y = () to change which distributions are being tested
%% Null hypothesis that late distribution (x,ax) dominantes early distribution (y,ay) is true
x = normrnd(0,1,100,1); % generates 100 normally distributed values with mean 0 and st. dev. of 1; this is the...
% early distribution
ax = zeros(size(x)) + 1; % one individual is found at each location
y = normrnd(0.2,1,100,1); % generates 100 normally distributed values with mean 0.2 and st. dev. of 1; this is the...
% late distribution
ay = zeros(size(y))+1; % one individual is found at each location
p1 = stochastic_dominance_test(x,y,ax,ay,200) % runs the previous data, with 200 bootstraps; output (p1) is...
% the proportion of bootstrapped samples with a test-statistic larger
% than the observed
%% Null hypothesis that late distribution (x,ax) dominantes early distribution (y,ay) is false
x = normrnd(0,1,100,1); % generates 100 normally distributed values with mean 0 and st. dev. of 1; this is the...
% early distribution
ax = zeros(size(x)) + 1; % one individual is found at each location
y = normrnd(0,1.7,100,1); % generates 100 normally distributed values with mean 0 and st. dev. of 1.7; this is the...
% late distribution (i.e., the CDFS cross at 0)
ay = zeros(size(y))+1; % one individual is found at each location
p2 = stochastic_dominance_test(x,y,ax,ay,200) % runs the previous data, with 200 bootstraps; output (p1) is...
% the proportion of bootstrapped samples with a test-statistic larger
% than the observed