260 likes | 738 Vues
Fitting Psychometric Functions. Florian Raudies 11/17/2011 Boston University. Overview. Definitions Parameters Fitting Example: Visual Motion Goodness of Fit Conclusion. Definitions. Labels for the axes of a psychometric function. Examples. Proportion correct. 2AFC
E N D
Fitting Psychometric Functions Florian Raudies 11/17/2011 Boston University
Overview Definitions Parameters Fitting Example: Visual Motion Goodness of Fit Conclusion
Definitions Labels for the axes of a psychometric function Examples Proportion correct 2AFC Two alternative forced choice Stimulus level
Definitions Special points of an psychometric function Psychometric function 75% PSE Point of subjective equivalence JND Just noticeable difference 50% Proportion correct 25% PSE 2JND Stimulus level
Definitions Weibull function Cumulative normal distribution function Logit function
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);
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 ) );
Parameters Additional parameters for a psychometric function with the parameter vector . - scale - shape - guessing rate. For nAFC. - miss rate. For a perfect observer .
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));
Fitting Assume: independent measurements with strength of the percept and response of participant in a 2AFC task. Problem: Maximum likelihood estimation for parameters of the psychometric function with
Fitting Small values and log-likelihood The term can lead to small values below the range of single or double precision. Thus, for optimization take the negative and apply the monotonic log-function function: This expression is maximized for the parameters . Often additional constraints for the parameters are available. This is a constraint nonlinear optimization problem with also referred to as nonlinear programming.
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));
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!
Example: Visual Motion A single trial Fixation & Blank for 100ms Fixation & 2nd Motion for 400ms Fixation & (Response) for 500ms Fixation & 1st Motion for 400ms 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?
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);
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
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.
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)