# FITTING PSYCHOMETRIC FUNCTIONS Florian Raudies 11/17/2011 Boston University 1.

## Presentation on theme: "FITTING PSYCHOMETRIC FUNCTIONS Florian Raudies 11/17/2011 Boston University 1."— Presentation transcript:

FITTING PSYCHOMETRIC FUNCTIONS Florian Raudies 11/17/2011 Boston University 1

Overview Definitions Parameters Fitting Example: Visual Motion Goodness of Fit Conclusion 2

Definitions Labels for the axes of a psychometric function Stimulus level Proportion correct Examples Experiment Design Proportion Correct 2AFC50…100% 3AFC33…100% 2IAFC50…100% 2AFC Two alternative forced choice 3

Definitions Special points of an psychometric function 4 Stimulus level Proportion correct 50% PSE 75% 25% PSE Point of subjective equivalence JND Just noticeable difference 2JND Psychometric function

Definitions Weibull function Cumulative normal distribution function Logit function 5

Definitions in Matlab function Y = weibullFunction(X, alpha, beta) % weibullFunction % X - Input values. % alpha - Parameter for scale. % beta - Parameter for shape. % % RETURN % Y - Return values. % % DESCRIPTION % See http://en.wikipedia.org/wiki/Weibull_distribution. Y = 1 - exp(-(X/alpha).^beta); 6

Definitions in Matlab function Y = cndFunction(X, mu,sigma) % cndFunction - Cumulative normal distribution function % Shift by one up and rescale because the integral for erf % ranges from 0 to value whereas the distribution uses the % boundaries -inf to value. Y = (1+erf( (X-mu)/(sqrt(2)*sigma) ))/2; function Y = logitFunction(X, mu,theta) % logitFunction… Y = 1./( 1 + exp( -(X-mu)/theta ) ); 7

Parameters 8

9

10

Definition in Matlab function Y = psycFunctionMissGuess(psycFunction,X,Theta,Const) % psycFunctionMissGuess % psycFunction - Function handle for the psychometric function. % X - Input values. % Theta - Parameter values. % Const - Constants, here guess rate and miss rate. % % RETURN % Y - Output values. Y = Const(1) … + (1 - Const(1) - Const(2)) * psycFunction(X,Theta(1),Theta(2)); 11

Fitting 12

Fitting 13

Fitting in Matlab function Theta = fittingPsycFunction(X, Y, opt) % fittingPsycFunction… ThetaMin = opt.ThetaMin; % Lower boundary for parameters. ThetaMax = opt.ThetaMax; % Upper boundary. ThetaIni = opt.ThetaIni; % Initial value for parameters. Const = opt.Const; % Constants in the psychometric function. psycFunction = opt.psycFunction; % Function handle for the psychometric function. % Optimization with the fmincon from the Matlab optimization toolbox. Theta = fmincon(@(Theta)logLikelihoodPsycFunction(... psycFunction, Theta, X,Y, Const),... ThetaIni, [],[],[],[], ThetaMin,ThetaMax, [], opt); function L = logLikelihoodPsycFunction(psycFunction, Theta, X,Y, Const) % logLikelihoodFunction… Xtrue = X(Y==1); Xfalse = X(Y==0); L = -sum(log( psycFunctionMissGuess(... psycFunction, Xtrue, Theta, Const) + eps))... -sum(log(1 - psycFunctionMissGuess(... psycFunction, Xfalse, Theta, Const) + eps)); 14

Example: Visual Motion Objective:Measure the coherence threshold for motion- direction discrimination. Design: 2AFC task between leftward and rightward motion for varying motion coherence by a limited dot lifetime in an random dot kinematogram (RDK). Use the method of constant stimuli for 11 coherence values. This requires usually more samples than adaptive thresholding techniques. Use 10 trials for each coherence value. This is a very simplified example! 15

Example: Visual Motion 16

Example: Visual Motion A single trial 17 Fixation & (Response) for 500ms Fixation & (Response) for 500ms Fixation & 1 st Motion for 400ms Fixation & 1 st Motion for 400ms Fixation & Blank for 100ms Fixation & Blank for 100ms Time Overall time 10 x 11 x 1,9sec = 209sec or 3.48min. A response is not expected before the first trail. Are the motions equal? Fixation & 2 nd Motion for 400ms Fixation & 2 nd Motion for 400ms

Example: Visual Motion 18 Correct / response Motion coherence (%) 0102030405060708090100 Trial 11/1 1000 20/1 0/01/10/01/1 1110 31/00/11/10/11/11/00/10001 41/11/00/10/00/1 0/00011 5 1/11/0 0/01/11110 60/10/01/01/1 0/01/10110 71/01/10/01/00/11/1 1001 80/00/1 0/0 0000 91/10/01/00/11/11/00/01111 100/11/00/0 0/10/0 0100 Correct (%) 50 607090100

Example: Visual Motion 19

Example in Matlab % Load data files. DataStimulus = dlmread('./DataMotionCoherenceStimulus00.txt'); DataObserver = dlmread('./DataMotionCoherenceObserver00.txt'); % "Response = 1" encodes correct and "Response = 0" incorrect. Response = double(DataStimulus(2:end,:)==DataObserver(2:end,:)); trialNum = size(Response,2); StimulusLevel = DataStimulus(1,:); % Fit data. opt.ThetaMin = [ 1.0 0.5]; % alpha, beta to optimize. opt.ThetaMax = [100.0 10.0]; opt.ThetaIni = [ 5.0 1.0]; opt.Const = [ 0.5 0.0]; % gamma, lambda are fixed. opt.psycFunction = @weibullFunction; StimulusLevelMatrix = repmat(StimulusLevel,[trialNum 1]); Theta = fittingPsycFunction(StimulusLevelMatrix, Response, opt); 20

Goodness of Fit Over dispersion or lack of fit Dependency between trials Non-stationary psychometric function (e.g. learning) Under dispersion or fit is too god Experimenter’s bias in removing outliers 21

Conclusion Use maximum likelihood to fit your data, while leaving the lapse rate as parameter being optimized. This is not the case in the presented code but can be adapted. Assess goodness of fit to: Ensure Parameter estimates and their variability are from a plausible model to describe the data. Identify uneven sampling of the stimulus level or outliers by applying an objective criteria. 22

References For fitting data Myung, Journal of Mathematical Psychology 47, 2003 Treutwein & Strasburger, Perception & Psychophysics 61(1), 1999 For goodness of fit Wichmann & Hill, Perception & Psychophysics 63(8), 2001 For detection theory Macmillan & Creelman. Detection theory - A user’s guide Psychology Press (2009) 23

Similar presentations