This code is missing a line that enables it to assume n=60 when n>60. While it may be inappropriate to make this assumption, at least the code will run to completion by adding this line. Here is the original code:
------------------------
% find row index to use in table for this sample
n_ind = [];
if n < 61 && n > 2
n_ind = find(peirce_r(:,1) == n);
else
if n >= 61
n = 60;
warning('n > 60; using r values for n==60');
end
if n < 2
error('this function does not support samples this small... please rethink what you are doing');
return;
end
end
--------------------------

add this line after the warning statement: n_ind = find(peirce_r(:,1) == n); and you end up with this:

------------------------------
% find row index to use in table for this sample
n_ind = [];
if n < 61 && n > 2
n_ind = find(peirce_r(:,1) == n);
else
if n >= 61
n = 60;
warning('n > 60; using r values for n==60');
n_ind = find(peirce_r(:,1) == n); % this line is missing from downloaded version - schauer added 140915
end
if n < 2
error('this function does not support samples this small... please rethink what you are doing');
return;
end
end
---------------------------------

Here is some code that uses the fxn. Copy and paste-able.

% generate random data:

pop_mean = 20;
pop_sd = 2;

% 1) to see how method works on random samples drawn from a normal distribution, use
% this dataset
sample_data1 = pop_mean + pop_sd*randn(1, 25);

% 2) to see how method works on random data that has built-in tendency to
% include outliers, use this method
sample_data2 = pop_mean + pop_sd*randn(1, 20);
% add in 1-4 obs of potentially outlying data
funny_data1 = pop_mean + 2*pop_sd + 3*pop_sd*rand(1, 2 + round(rand(1)));
funny_data2 = pop_mean + 4*pop_sd*randn(1,4);

sample_data2 = [sample_data2 funny_data2];

% 3) Ross example data; contains 2 points which will be rejected by Peirce's
% method

% make filter -- to help with display purposes -- (might want to make this
% part of apply_peirce.m)
pass_peirce = zeros(size(mydata));
for j=1:length(cleaned_data)
pass_peirce = pass_peirce | mydata == cleaned_data(j);
end

obs_index = 1:length(mydata);

% plot data (kept == blue circles) and outliers (red x's)

figure(1);

plot(obs_index, mydata, '.k');
hold on;
plot(obs_index(pass_peirce), mydata(pass_peirce), 'ob', 'MarkerSize', 10);
plot(obs_index(~pass_peirce), mydata(~pass_peirce), 'xr', 'MarkerSize', 15);
hold off;

On a quick look, the Moore-Rayleigh test for uniformity of vector data (B.R. Moore, Biometrika, 1980) does not seem to be available in this toolbox. Philipp, do you have any plans to implement it? Alternatively, does anyone know if a Matlab implementation of that test is available elsewhere? Thanks.

Hi everybody!
I have a question about circ_plot.m; When I execute this code the angles appear from 0 to 360 degrees.
I only want represent values from 0 to 180. How I can do it? Thanks in advance!

Actually, ignore the inverse_cdf function I have provided. It should generate a vlaue for kappa and it needs adjusting for values of thetahat other than zero.

Great submission. It would be nice to have cdf and inversion cdf for the vmpdf functions. Here's what I wrote for my needs
function p = circ_vmcdf(alpha, thetahat, kappa)
%integrates the pdf from an angle of -pi to an angle alpha
F = @(x)circ_vmpdf(x, thetahat, kappa);
p = quad(F,-pi(),alpha);
end
function theta = circ_vminv(p, thetahat, kappa)
%computes the inverse of the abovecirc_vmcdf.
fun =@(alpha)(circ_vmcdf(alpha, thetahat, kappa)-p);
theta = fzero(fun,[-pi pi]);
end

Comment only