petejonze / QuestPlus

QuestPlus: a MATLAB implementation of the QUEST+ adaptive psychometric method
Other
11 stars 3 forks source link

for StimDomain = linspace(0,1,50) it always gives zero for stimulus #1

Closed DBermudez0 closed 4 years ago

DBermudez0 commented 4 years ago

% set Quest+ procedure F = @(x,mu)([1-normcdf(x,mu,1),normcdf(x,mu,1)])'; mu = 2; trueParams = {mu}; % create QUEST+ object stimDomain = linspace(0, 1, 60); paramDomain = linspace(-5,5,100); respDomain = [0 1]; stopRule = 'ntrials'; stopCriterion = length(Trial_post);

QP = QuestPlus(F, stimDomain, paramDomain, respDomain, stopRule, stopCriterion); % initialise (with default, uniform, prior) QP.initialise(); startGuess_mean = QP.getParamEsts('mean'); startGuess_mode = QP.getParamEsts('mode'); for i = 1:length(Trial_post) targ = QP.getTargetStim(); QP.update(targ, anscorrect(i)); end

It gives always gives me 0 for the targ, but the stimDomain are values between 0 and 1. Why is it always giving me zero for stimulus?

petejonze commented 4 years ago

I can't run that code, as certain variables aren't defined (e.g., Trial_post), but I'd note that your stimulus domain is very narrow. Maybe your simulated observer is always answering correctly, and so the algorithm is at floor?

Here is a lightly modified version that seems (to me) to work fine:

% set Quest+ procedure F = @(x,mu)([1-normcdf(x,mu,1),normcdf(x,mu,1)])'; mu = 2; trueParams = {mu}; % create QUEST+ object stimDomain = linspace(0, 5, 20); paramDomain = linspace(0,5, 20); respDomain = [0 1]; stopRule = 'ntrials'; stopCriterion = 50;

QP = QuestPlus(F, stimDomain, paramDomain, respDomain, stopRule, stopCriterion); % initialise (with default, uniform, prior) QP.initialise();

% get start est startGuess_mean = QP.getParamEsts('mean') startGuess_mode = QP.getParamEsts('mode')

% run while ~QP.isFinished() targ = QP.getTargetStim(); anscorrect = (targ+randn()) > mu QP.update(targ, anscorrect); end

% get end est endGuess_mean = QP.getParamEsts('mean') endGuess_mode = QP.getParamEsts('mode')

DBermudez0 commented 4 years ago

I was able to fix the issue. I am able to get contrast between 0 and 1. However, I want to have the QuestPlus procedure to give me suggested contrast values between 0 and 1 using a 2-by-1 staircase procedure. Meaning it gives a lower contrast value every time the users gets the correct answer twice in a row. While it gives a higher contrast value every time it gets the wrong. How would I modify the script I have to accommodate for this??

F = @(x,mu)([1-normcdf(x,mu,1),normcdf(x,mu,1)])'; stimDomain = linspace(0, 1, 40); paramDomain = linspace(0,1,40); respDomain = [0 1]; stopRule = 'ntrials'; stopCriterion = 50; QP = QuestPlus(F, stimDomain, paramDomain, respDomain, stopRule, stopCriterion); % initialise (with default, uniform, prior) QP.initialise(); for i = 1:50 targ = QP.getTargetStim(); anscorrect = randi([0,1]); QP.update(targ, anscorrect); end

petejonze commented 4 years ago

The psychophysical algorithm determines what stimulus to present next. The QUEST+ algorithm selects the most informative stimulus to present next. If you want a 2-1 staircase instead then you should use a staircase algorithm, not QUEST+. I've attached a MATLAB implementation of the staircase algorithm, along with some examples of use.

psychophysics.zip

DBermudez0 commented 4 years ago

Can you give me a little clarification on the examples. Particularly, Why is s.update(true); and s.update(false) repeated so many times in the script? The implementation seems different than that of the Quest+ script

DBermudez0 commented 4 years ago

When I run the AdaptiveTrack_example script I get the following error message Undefined function 'vline' for input arguments of type 'double'.

Error in AdaptiveTrack/updatePlot (line 445) obj.figHandles.vlines{i} = vline(find(idx), obj.stageColours{i});

Error in AdaptiveTrack/update (line 358) obj.updatePlot();

Error in AdaptiveTrack_example (line 12) s.update(false);

petejonze commented 4 years ago

You can get vline off FileExchange. I think at this point we've strayed quite far from this QUEST+ repository. If you want a general introduction to psychophysics, I recommend the Palamedes Toolbox and its associated textbook: http://www.palamedestoolbox.org/

Good luck!