1. Play with the diffusion model, using the demo code. Vary each of the model parameters: z, mu, sigma, a. For each, describe how the model predictions change, and try to give an intuitive explanation based on the parameter's psychological interpretation.
2. Simulate the Bayesian random walk model, using equal-variance Gaussians for pS and pN.
mNoise = 0; %mean of noise distribution
sigma = 1; %standard deviation of both distributions
Decision threshold—corresponds to log-odds of accuracy, so try to define it that way
Starting point—corresponds to prior log-odds, so try to define it that way
Time constant for converting number of samples to RT
Setup for simulation
Create a sequence of correct categories (i.e., signal or noise on each trial)
Create arrays for tracking response and RT across trials
RT = zeros(N,1); %RT for each trial
Loop through trials and simulate each step of the model
Number of observations
Sample observations until reaching threshold (hint: use a while loop)
Calculate the loglikelihood ratio for this observation; try to work through the algebra using the expressions for Gaussian distributions, and then compare to Eq 17 from this week's chapter
Increment the evidence and the count of observations
n = n + 1; %increment count of observations
Record response and RT for this trial
RT(i) = n*tau; %RT for this trial
Show results
for i=1:2,for j=1:2 %correct answer i, actual answer j
disp(' ')
disp('Response probabilities on signal trials')
disp(['Signal response: ' num2str(rProbs(1,1)) '; Noise response: ' num2str(rProbs(1,2))])
disp('Response probabilities on noise trials')
disp(['Signal response: ' num2str(rProbs(2,1)) '; Noise response: ' num2str(rProbs(2,2))])
RT distributions for both responses under both categories
for i=1:2,for j=1:2 %correct answer i, actual answer j
hist(RT(H==i & r==j),tau/2:tau:max(RT)+tau) %RTs for this trial type and this response, with bin size equal to tau
set(gca,'XLim',[0 max(RT)],'Ylim',[0 max(histc(RT,0:tau:max(RT)))]) %put all graphs on same scale
if i==1&&j==1,ylabel('Signal Trials'),end
if i==2&&j==1,xlabel('Signal Responses'),ylabel('Noise Trials'),end
if i==2&&j==2,xlabel('Noise Responses'),end