%StBetaDemo % This program calls on stretchbetaval.m, a function to return a % stretched beta value from a beta distribution with a defined % Mean (mn),st. deviation (sd), and min and max boundaries %(minb and maxb). The other input to stretchbeta is fx, % a cumulative distribution funtion value. % This program calculates random values for each of several % mean and st. deviation values clear all; %*****************Simulation Parameters*********************** % define vectors for the means, sd's, minimum, % and maximum values for each vital rate ratemns= [0.5, 3, 20]; ratesds= [0.4, 2, 14]; ratemins=[0, 0, 5]; ratemaxs=[2, 10, 100]; reps = 100; %how many values to make for each parameter combo %************************************************************* results = []; rand('state',sum(100*clock)); %seeds random number generator ratenum = length(ratemns); for rate = 1:ratenum % use each set of parameter values for rr = 1:reps temp(rr) = stretchbetaval(ratemns(rate),ratesds(rate),... ratemins(rate),ratemaxs(rate),rand); end; % rr results(:,(rate)) = temp'; % store results end; % rate disp('mean, sd, min, and max of the simulated rates,') disp('to compare with the input values'); disp([mean(results);std(results);min(results);max(results)]); [freqs,bins] = hist(results,40); % make binned results disp('The format of the following results is the same'); disp('as those from Betademo.m in Box 8.3') finalresults = [zeros(2,1),results(1:2,:); bins,freqs]