File: FitLogitYN.m

package info (click to toggle)
psychtoolbox-3 3.0.19.14.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,796 kB
  • sloc: ansic: 176,245; cpp: 20,103; objc: 5,393; sh: 2,753; python: 1,397; php: 384; makefile: 193; java: 113
file content (30 lines) | stat: -rw-r--r-- 972 bytes parent folder | download | duplicates (3)
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
function [a,b,thresh50] = FitLogitYN(inputs,nYes,nNo)
% [a,b,thresh50] = FitLogitYN(inputs,nYes,nNo)
% 
% Fit a logistic function to YN psychometric data.
% Returns logistic parameters and 50% threshold. 
%
% The form of the logistic equation is pYes = 1/(1+10^-(a*inputs+b))
% 
% The logistic is not a good function to use for serious work,
% but you can do a quick and dirty fit analytically and
% you can explain it to students more easily than some
% other candidate models for psychometric functions.
%
% See also: FitLogistic, FitWeibYN, FitCumNormYN, 
%  InvertLogistic, ComputeLogistic.
%
% 2/8/97    dhb     Wrote it.

% Make sure there are trials passed at all input levels.
% Ignore any input levels with no trials.
pYes = nYes ./ (nYes + nNo);
index = find(~isnan(pYes));
if (isempty(index))
    error('FitLogitYN: No input trials passed');
end
pYes = pYes(index);
inputs = inputs(index);

[a,b] = FitLogistic(inputs,pYes);
thresh50 = InvertLogistic(0.5,a,b);