/usr/share/psychtoolbox-3/PsychTests/FitCumNormYNTest.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 | % FitCumNormYNTest
%
% 9/22/93 jms Created from FitWeibullYN.
% 2/8/97 dhb Cleaned up for current calling conventions.
% Upward Sloping Psychometric Function
disp('Fitting an upward sloping psychometric function');
% Set input values
maxInput = 100;
inputs = [1:1:maxInput]';
[m,n] = size(inputs);
% Set parameters and generate some data
uIn = 20;
varIn = 5;
nYes = round(100*NormalCumulative(inputs,uIn,varIn));
nNo = 100-nYes;
% Fit and generate prediction
[uEst,varEst] = FitCumNormYN(inputs,nYes,nNo);
pInputs = [1:maxInput];
predict = NormalCumulative(pInputs,uEst,varEst);
% For comparision, fit a logistic to the same data
[a,b,threshLogit] = FitLogitYN(inputs,nYes,nNo);
predictLogit = ComputeLogistic(pInputs,a,b);
% Print comparision of fit normal and logistic thresholds
fprintf('Normal fit finds threshold at %g, logit at %g\n',uEst,threshLogit);
% Make a plot fo the output
hold off
plot(inputs,nYes./(nYes+nNo),'+');
title('Fit to upward sloping YN psychometric function')
hold on
plot(pInputs,predict,'g');
plot(pInputs,predictLogit,'r');
hold off
|