function [X, P1] = MEBPinit(samplingftn, weightsftn) % function [X, P1] = MEBPinit(samplingftn, weightsftn) % % returns a randomly chosen initial state for an MEBP process % % samplingftn is a function handle for a function that samples from % the offspring sampling distribution n*p(n)/mu % weightsftn is a function handle for a function that samples from % the weights distribution, given the number of offspring % % X = (kappa(0,0,1), S(0,0,1), Z(0,1,1), alpha(0,0,1), P(0,1,1)) % % types are 0+ 0- 1+ 1- -1+ -1-, labelled 1 2 3 4 5 6 % % P1 is the weight of the first crossing at level 0 % % Owen Jones 6 July 2003, 17 January 2007 X = {{1, 0, 0, 0, []}}; X{1}{3} = feval(samplingftn, []); X{1}{2} = ceil(rand*X{1}{3}); X{1}{5} = feval(weightsftn, X{1}{3}); if X{1}{2} == X{1}{3} if rand < 0.5, X{1}{4} = 3; else X{1}{4} = 6; end elseif mod(X{1}{2},2) == 1 if rand < 0.5, X{1}{4} = 1; else X{1}{4} = 2; end else if rand < 0.5, X{1}{4} = 4; else X{1}{4} = 5; end end P1 = X{1}{5}(1);