/usr/share/psychtoolbox-3/PsychTests/FitWeibullYNTest.m is in psychtoolbox-3-common 3.0.11.20140816.dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | % FitWeibYNTest
%
% Simple test of our ability to fit a Weibull to YN data.
% The underlying routine requires the optimization toolbox.
%
% 2/5/97 dhb Added comments.
% Set up inputs
maxInput = 20;
inputs = [1:1:maxInput]';
[m,n] = size(inputs);
% Cook some data
disp('Fitting an upward sloping psychometric function');
in_alpha = 6;
in_beta = 3;
nYes = round(100*ComputeWeibYN(inputs,in_alpha,in_beta));
nNo = 100-nYes;
% Fit it
[alpha,beta,thresh] = FitWeibYN(inputs,nYes,nNo);
% Make a prediction
pInputs = 0.1:0.1:maxInput;
predict = ComputeWeibYN(pInputs,alpha,beta);
figure(1);
hold off
plot(inputs,nYes./(nYes+nNo),'+');
title('Attempt to fit an upward sloping YN psychometric function')
hold on
plot(pInputs,predict,'g');
hold off
% Cook some data
disp('Fitting a downward sloping psychometric function');
in_alpha = 6;
in_beta = -2.5;
nYes = round(100*ComputeWeibYN(inputs,in_alpha,in_beta));
nNo = 100-nYes;
% Fit it
[alpha,beta,thresh] = FitWeibYN(inputs,nYes,nNo);
% Make a prediction
pInputs = 0.1:0.1:maxInput;
predict = ComputeWeibYN(pInputs,alpha,beta);
% Plot it
figure(2);
plot(inputs,nYes./(nYes+nNo),'+');
title('Attempt to fit a downward sloping YN psychometric function')
hold on
plot(pInputs,predict,'g');
hold off
|