function SubSet_test
% simple test for ubset simulation     

stochast(1).Name = 'R';
stochast(1).Distr = @norm_inv;  % all standard uniformly distributed
stochast(1).DistrPdf = @normpdf;
stochast(1).Params = {7 1};

stochast(2).Name = 'S';
stochast(2).Distr = @norm_inv;  % all standard uniformly distributed
stochast(2).DistrPdf = @normpdf;
stochast(2).Params = {0 1};

for jj=1:length(stochast)
    stochast(jj).propertyName = true;
end

%% start computation
results = SubSet(...
    'stochast', stochast,...         % stochast structure
    'x2zFunction', @X2Z_testSS,...   % Function to transform x to z    
    'method', 'matrix',...           % z-function method 'matrix' (default) or 'loop'
    'delta', 0.3, ...                  % parameter of the uniform proposal distribution of the MCMC procedure
    'Nsamples', 1e3, ...             % number of samples per subset
    'p0', 0.1...                     % decrease in excedance probability for subsequent subsets 
    );

kk=2;



function Z = X2Z_testSS(varargin)

% input
%    structure with samples (probabilities)
%
% output
%    Z-value(s)


%% defaults
OPT = struct('R', [], 'S', []);

% overrule default settings by property pairs, given in varargin
OPT = setproperty(OPT, varargin{:});

%% compute Z-function

Z = OPT.R - OPT.S;


