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;

This is a great toolbox. However, I have an issue with circ_corrcl, or perhaps I'm misunderstanding its proper use. When I feed it perfectly correlated data, I do not get rho=1:
circ_corrcl(linspace(-pi,pi,1000),linspace(0,10,1000))
ans = .7785
I noticed this while trying to see if I could get a sign for the rho value (which is always positive by the definition in the function). Unfortunately, I don't have a copy of the Zar text available.

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.

Comment only