function printout(out_ticker,MaxDup,contrib_out,prey_num,runique, Lmax)
% generate results table for pop-up message box...
%__________________________________________________________________________
S1=(' %%%%% DIAGNOSTICS AND RESULTS %%%%%');
lnspace=(' ');%line spacer
aa=('Does the number of iterations seem appropriate?');
S1 = strvcat(S1,lnspace,aa);
if out_ticker > 1000
aa=[' Probably! - there are ',num2str(out_ticker), ' posterior draws (more than 1000)'];
else
aa=[' Probably not! - there are ',num2str(out_ticker), ' posterior draws (less than 1000)'];
end
S1 = strvcat(S1,aa);
if MaxDup < 2
aa=[' Probably! - there are no duplicate draws in the posterior chain'];
else
aa=[' Probably not! - a single posterior draw has been duplicated ',num2str(MaxDup), ' times in the posterior chain'];
end
S1 = strvcat(S1,aa,lnspace);
%put one line spacers here on concat... then
aa =['unique parameter vectors in resample = ',num2str(runique),' out of ' num2str(out_ticker)];
S1 = strvcat(S1,aa);
aa = ['ratio between the posterior at the best draw, and the total posterior density is ', num2str(Lmax)];
S1 = strvcat(S1,aa);
aa = (' **NOTE- this ratio should be less than .01');
S1 = strvcat(S1,aa,lnspace,lnspace);
%ut two line spaces here on concat... then
aa = ('Value at each percentile of the posterior proportional contribution of each source (median values @ 50%):');
S1 = strvcat(S1,aa,lnspace);
aa= ('5% 25% 50% 75% 95%');
S1 = strvcat(S1,aa);
aa=('---------------------------------------------------------------------------');
S1 = strvcat(S1,aa);
aa = (prctile(contrib_out,[5 25 50 75 95])'); % a useful summary of x
aa = num2str(round(aa.*1000) /1000); %rounds to 3 decimal places
S1 = strvcat(S1,aa,lnspace,lnspace);
%put two line spacers here on concat... then
%fit a beta distrib Beta(A,B) to each posterior source proportion chain,
%and show the results here
aa=('Beta parameter fits (A & B) for each source contribution:');
S1 = strvcat(S1,aa);
aa=(' A B');
S1 = strvcat(S1,aa);
aa=('-------------------------------');
S1 = strvcat(S1,aa);
for iii = 1:prey_num %for each source
tempfit = betafit(contrib_out(:,iii)); %get A and B from betafit function based on data
beta_out(iii,1)= tempfit(1,1);
beta_out(iii,2)= tempfit(1,2);
end;
aa = num2str(beta_out);
S1 = strvcat(S1,aa);
msgbox(S1,'Model Run Results');