% Compare various measurements of group size.
clear
Ndim = 2; % 2D targets!
Ngroup = 5 % 5-shot groups
Ntrials = 10000 % Number of trials (groups).
Pflyer = 0.2
sigma_flyer = 5
size_ratio = 1.5 % Size of larger groups compared to smaller.

t0 = cputime;
for trial = 1:Ntrials
   r1 = pdf_flyers(Ngroup, Ndim, Pflyer, sigma_flyer);
   r2 = size_ratio * pdf_flyers(Ngroup, Ndim, Pflyer, sigma_flyer);
   
   % RMS radius
   rmsrad1(trial) = rms_radius(r1);
   rmsrad2(trial) = rms_radius(r2);
   
   % Extreme spread
   extspr1(trial) = extreme_spread(r1);
   extspr2(trial) = extreme_spread(r2);

   % Less Extreme spread
   lextspr1(trial) = less_extreme_spread(r1);
   lextspr2(trial) = less_extreme_spread(r2);

end

time_elapsed_sec = cputime - t0

O= 'What is the fractional uncertainty in each width measure? = O'
rmsrad1_err = std(rmsrad1)/mean(rmsrad1)
extspr1_err = std(extspr1)/mean(extspr1)
lextspr1_err = std(lextspr1)/mean(lextspr1)

O= 'How often does each method rank groups r1 & r2 correctly? = O'
rmsrad_success = sum( rmsrad2 > rmsrad1 ) / Ntrials
extspr_success = sum( extspr2 > extspr1 ) / Ntrials
lextspr_success = sum( lextspr2 > lextspr1 ) / Ntrials


