%%% C:/work/PLPaper2/simul/SpeedCompar.txt

****************************************************************************
******
******  07 June 2005 -- Compare the speed of learning with and without
******  feedback, everything else being equal. 
******
******  Main loop:   % see script SPEEDCOMPAR.M
******    Generate N_RUNS stimulus sequences
******    Run PLM_HEBB1 with feedback-optimized parameters
******    Run PLM_HEBB1 with no-feedback-optimized parameters
******    Fit exponential regressions to both, store the resulting TAUs
******  Repeat for N_EPOCHS
******
****************************************************************************

» cd('C:\work\PLPaper2\simul');  % or C:\users\apetrov\PLPaper2\simul

» clear all;load('..\..\PLModel1\PLM_CACHE.mat');load('..\..\PLModel1\sched.mat');load('..\..\PLExp2\modelfits\sched36.mat');

» Mpar_fdbk=PLM_params
Mpar_fdbk = 
      rep_size: [7 5 1]
       max_act: 0.5000
      rep_gain: 0.8000
     rep_noise: 0.1000
     out_noise: 0.1950
      W_minmax: [-1 1]
        W_init: 0.1700
       W0_seed: [35x1 double]
    learn_rate: 0.0015
    runav_rate: 0.0200
     criterion: 2.2000
    fdbk_fract: 1
      blk_size: 300

» Mpar_nofk=Mpar_fdbk;Mpar_nofk.out_noise=.1578;Mpar_nofk.criterion=.8679
Mpar_nofk = 
      rep_size: [7 5 1]
       max_act: 0.5000
      rep_gain: 0.8000
     rep_noise: 0.1000
     out_noise: 0.1578
      W_minmax: [-1 1]
        W_init: 0.1700
       W0_seed: [35x1 double]
    learn_rate: 0.0015
    runav_rate: 0.0200
     criterion: 0.8679
    fdbk_fract: 1           % <-- feedback column-vector must be set to zero from the outside
      blk_size: 300

» N_runs=100 ;    % must be an even number
» whos
  Name            Size         Bytes  Class
-----------------------------------------------------------
  Idef            1x1           3384  struct array
  Mpar_fdbk       1x1           2012  struct array
  Mpar_nofk       1x1           2012  struct array
  N_runs          1x1              8  double array
  PLM_CACHE      12x1       16803792  struct array (global)
  bnd             1x6             48  double array
  bnd36           1x6             48  double array
  sched1         32x1           9088  cell array
  sched2         32x1           9088  cell array
  sched36_1      36x1          10224  cell array
  sched36_2      36x1          10224  cell array
-----------------------------------------------------------

%%% The workspace is now set for calling the script SPEEDCOMPAR.M

% tic;SpeedCompar;toc    % N_runs==100 takes about 60 minutes on Dell OptiPlex GX400

%%% Run 10 epochs of 8*100 runs each -- takes about 8 hours on Dell OptiPlex
tic;N_runs=100;N_epochs=10;
for kk=1:N_epochs
  SpeedCompar;
  dprime(kk).N_runs=sst32fdbk_Mfdbk.N_runs;dprime(kk).fdbk32_Mfdbk=sst32fdbk_Mfdbk.dprime;dprime(kk).fdbk32_Mnofk=sst32fdbk_Mnofk.dprime;dprime(kk).fdbk36_Mfdbk=sst36fdbk_Mfdbk.dprime;dprime(kk).fdbk36_Mnofk=sst36fdbk_Mnofk.dprime;dprime(kk).nofk32_Mfdbk=sst32nofk_Mfdbk.dprime;dprime(kk).nofk32_Mnofk=sst32nofk_Mnofk.dprime;dprime(kk).nofk36_Mfdbk=sst36nofk_Mfdbk.dprime;dprime(kk).nofk36_Mnofk=sst36nofk_Mnofk.dprime;
  zP_congr(kk).N_runs=sst32fdbk_Mfdbk.N_runs;zP_congr(kk).fdbk32_Mfdbk=sst32fdbk_Mfdbk.zP_congr;zP_congr(kk).fdbk32_Mnofk=sst32fdbk_Mnofk.zP_congr;zP_congr(kk).fdbk36_Mfdbk=sst36fdbk_Mfdbk.zP_congr;zP_congr(kk).fdbk36_Mnofk=sst36fdbk_Mnofk.zP_congr;zP_congr(kk).nofk32_Mfdbk=sst32nofk_Mfdbk.zP_congr;zP_congr(kk).nofk32_Mnofk=sst32nofk_Mnofk.zP_congr;zP_congr(kk).nofk36_Mfdbk=sst36nofk_Mfdbk.zP_congr;zP_congr(kk).nofk36_Mnofk=sst36nofk_Mnofk.zP_congr;
  zP_incon(kk).N_runs=sst32fdbk_Mfdbk.N_runs;zP_incon(kk).fdbk32_Mfdbk=sst32fdbk_Mfdbk.zP_incon;zP_incon(kk).fdbk32_Mnofk=sst32fdbk_Mnofk.zP_incon;zP_incon(kk).fdbk36_Mfdbk=sst36fdbk_Mfdbk.zP_incon;zP_incon(kk).fdbk36_Mnofk=sst36fdbk_Mnofk.zP_incon;zP_incon(kk).nofk32_Mfdbk=sst32nofk_Mfdbk.zP_incon;zP_incon(kk).nofk32_Mnofk=sst32nofk_Mnofk.zP_incon;zP_incon(kk).nofk36_Mfdbk=sst36nofk_Mfdbk.zP_incon;zP_incon(kk).nofk36_Mnofk=sst36nofk_Mnofk.zP_incon;
  save SpeedCompar dprime zP_congr zP_incon ; fprintf(' saved to SPEEDCOMPAR.MAT\n');
end;toc


****************  June 8, 2005  -- Regression fits
*
» cd('C:\work\PLPaper2\simul');  % or C:\users\apetrov\PLPaper2\simul

» clear all;load SpeedCompar; whos
  Name           Size         Bytes  Class
-----------------------------------------------------------
  dprime         1x10         73928  struct array
  zP_congr       1x10         73928  struct array
  zP_incon       1x10         73928  struct array
-----------------------------------------------------------

%%  Aggregate and plot
adpr.N_runs=sum([dprime(:).N_runs]);aZc.N_runs=sum([zP_congr(:).N_runs]);aZi.N_runs=sum([zP_incon(:).N_runs]);
adpr.fdbk32_Mfdbk=mean(cat(3,dprime(:).fdbk32_Mfdbk),3);adpr.fdbk32_Mnofk=mean(cat(3,dprime(:).fdbk32_Mnofk),3);
adpr.fdbk36_Mfdbk=mean(cat(3,dprime(:).fdbk36_Mfdbk),3);adpr.fdbk36_Mnofk=mean(cat(3,dprime(:).fdbk36_Mnofk),3);
adpr.nofk32_Mfdbk=mean(cat(3,dprime(:).nofk32_Mfdbk),3);adpr.nofk32_Mnofk=mean(cat(3,dprime(:).nofk32_Mnofk),3);
adpr.nofk36_Mfdbk=mean(cat(3,dprime(:).nofk36_Mfdbk),3);adpr.nofk36_Mnofk=mean(cat(3,dprime(:).nofk36_Mnofk),3);
aZc.fdbk32_Mfdbk=mean(cat(3,zP_congr(:).fdbk32_Mfdbk),3);aZc.fdbk32_Mnofk=mean(cat(3,zP_congr(:).fdbk32_Mnofk),3);
aZc.fdbk36_Mfdbk=mean(cat(3,zP_congr(:).fdbk36_Mfdbk),3);aZc.fdbk36_Mnofk=mean(cat(3,zP_congr(:).fdbk36_Mnofk),3);
aZc.nofk32_Mfdbk=mean(cat(3,zP_congr(:).nofk32_Mfdbk),3);aZc.nofk32_Mnofk=mean(cat(3,zP_congr(:).nofk32_Mnofk),3);
aZc.nofk36_Mfdbk=mean(cat(3,zP_congr(:).nofk36_Mfdbk),3);aZc.nofk36_Mnofk=mean(cat(3,zP_congr(:).nofk36_Mnofk),3);
aZi.fdbk32_Mfdbk=mean(cat(3,zP_incon(:).fdbk32_Mfdbk),3);aZi.fdbk32_Mnofk=mean(cat(3,zP_incon(:).fdbk32_Mnofk),3);
aZi.fdbk36_Mfdbk=mean(cat(3,zP_incon(:).fdbk36_Mfdbk),3);aZi.fdbk36_Mnofk=mean(cat(3,zP_incon(:).fdbk36_Mnofk),3);
aZi.nofk32_Mfdbk=mean(cat(3,zP_incon(:).nofk32_Mfdbk),3);aZi.nofk32_Mnofk=mean(cat(3,zP_incon(:).nofk32_Mnofk),3);
aZi.nofk36_Mfdbk=mean(cat(3,zP_incon(:).nofk36_Mfdbk),3);aZi.nofk36_Mnofk=mean(cat(3,zP_incon(:).nofk36_Mnofk),3);

save SpeedCompar

» adpr
adpr = 
          N_runs: 1000
    fdbk32_Mfdbk: [32x3 double]
    fdbk32_Mnofk: [32x3 double]
    fdbk36_Mfdbk: [36x3 double]
    fdbk36_Mnofk: [36x3 double]
    nofk32_Mfdbk: [32x3 double]
    nofk32_Mnofk: [32x3 double]
    nofk36_Mfdbk: [36x3 double]
    nofk36_Mnofk: [36x3 double]


%-- Plot the d-primes. 'o-'=trial-by-trial fdbk, '.-'=no fdbk, same stimuli, same parameters
subplot(2,2,1);t=[1:32]';plot(t,adpr.fdbk32_Mfdbk,'bo-',t,adpr.nofk32_Mfdbk,'.r-');axis([0 37 0 3.5]);set(gca,'xtick',[0:4:36]);grid on;title('feedback parameters');ylabel('d''');
subplot(2,2,2);t=[1:36]';plot(t,adpr.fdbk36_Mfdbk,'bo-',t,adpr.nofk36_Mfdbk,'.r-');axis([0 37 0 3.5]);set(gca,'xtick',[0:4:36]);grid on;title('feedback parameters');ylabel('d''');
subplot(2,2,3);t=[1:32]';plot(t,adpr.fdbk32_Mnofk,'bo-',t,adpr.nofk32_Mnofk,'.r-');axis([0 37 0 3.5]);set(gca,'xtick',[0:4:36]);grid on;title('no-feedback parameters');ylabel('d''');
subplot(2,2,4);t=[1:36]';plot(t,adpr.fdbk36_Mnofk,'bo-',t,adpr.nofk36_Mnofk,'.r-');axis([0 37 0 3.5]);set(gca,'xtick',[0:4:36]);grid on;title('no-feedback parameters');ylabel('d''');
% saved as C:\work\PLPaper2\simul\SpCompDpr.pdf

%-- Z-probability plots
subplot(2,2,1);t=[1:32]';plot(t,aZc.fdbk32_Mfdbk,'bo-',t,aZc.nofk32_Mfdbk,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('congruent stimuli, feedback params');ylabel('zPcorrect');
subplot(2,2,2);t=[1:36]';plot(t,aZc.fdbk36_Mfdbk,'bo-',t,aZc.nofk36_Mfdbk,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('congruent stimuli, feedback params');ylabel('zPcorrect');
subplot(2,2,3);t=[1:32]';plot(t,aZc.fdbk32_Mnofk,'bo-',t,aZc.nofk32_Mnofk,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('congruent stimuli, no-feedback params');ylabel('zPcorrect');
subplot(2,2,4);t=[1:36]';plot(t,aZc.fdbk36_Mnofk,'bo-',t,aZc.nofk36_Mnofk,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('congruent stimuli, no-feedback params');ylabel('zPcorrect');

subplot(2,2,1);t=[1:32]';plot(t,aZi.fdbk32_Mfdbk,'bo-',t,aZi.nofk32_Mfdbk,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('incongruent stimuli, feedback params');ylabel('zPcorrect');
subplot(2,2,2);t=[1:36]';plot(t,aZi.fdbk36_Mfdbk,'bo-',t,aZi.nofk36_Mfdbk,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('incongruent stimuli, feedback params');ylabel('zPcorrect');
subplot(2,2,3);t=[1:32]';plot(t,aZi.fdbk32_Mnofk,'bo-',t,aZi.nofk32_Mnofk,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('incongruent stimuli, no-feedback params');ylabel('zPcorrect');
subplot(2,2,4);t=[1:36]';plot(t,aZi.fdbk36_Mnofk,'bo-',t,aZi.nofk36_Mnofk,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('incongruent stimuli, no-feedback params');ylabel('zPcorrect');

*****************************************************************************

Date: Wed, 08 Jun 2005 18:44:36 -0700
To: Barbara Dosher <bdosher@uci.edu>, Zhong-Lin Lu <zhonglin@usc.edu>
From: Alexander Petrov <apetrov@uci.edu>
Subject: Feedback should improve learning, our model predicts

Dear Barbara and Zhong-Lin,

The simulation results are in, and are very clear.  I didn't even bother 
to do regression fits.  Our model predicts that feedback should improve 
both the speed and the asymptote of learning. The enclosed figures 
[SpeedCompar.pdf, 3 pages] report the d's and zP's for 8 simulations of 
1000 runs each. It is a 2x2x2 design with the following factors:
  1. trial-by-trial feedback (blue circles) vs no feedback (red dots)
  2. parameters optimized to fit the feedback data (top panels) vs parameters optimized to fit the no-feedback data (bottom panels)
  3. 32-block protocol (left panels) vs 36-block protocol (right panels)

On any given panel, the model is run twice on the same stimulus sequences 
with the same parameters. As you can see, there is substantially less learning 
in the no-feedback condition (red dots). The difference is particularly 
striking under the feedback-optimized parameters. I don't quite know why. 
The two parameter sets have the same learning rate and differ only in the 
decision noise (0.195 w/ fdbk vs. 0.158 w/o) and the criterion-adjustment 
factor (2.2 w/ vs. 0.87 w/o fdbk).

The model is thus barely consistent with the empirical finding of higher 
asymptotes without feedback!  The behavioral data can still be due to 
inter-observer variation, I think, just because the individual differences 
are so great. But we may be walking on thin ice here.

All in all, we should be very cautious with our claims and conclusions.

What do you think?

  -- Alex


****************************************************************************
******
******  10 June 2005 -- Explore the parameter space some more
******


» cd('C:\work\PLPaper2\simul');  % or C:\users\apetrov\PLPaper2\simul

» clear all;load('..\..\PLModel1\PLM_CACHE.mat');load('..\..\PLModel1\sched.mat');load('..\..\PLExp2\modelfits\sched36.mat');

» Mpar_decn=PLM_params;Mpar_decn.out_noise=.1578     % decision noise only
Mpar_decn = 
      rep_size: [7 5 1]
       max_act: 0.5000
      rep_gain: 0.8000
     rep_noise: 0.1000
     out_noise: 0.1578           % <-- optimized to fit PLExp2
      W_minmax: [-1 1]
        W_init: 0.1700
       W0_seed: [35x1 double]
    learn_rate: 0.0015
    runav_rate: 0.0200
     criterion: 2.2000           % <-- left at PLExp1 default
    fdbk_fract: 1
      blk_size: 300

» Mpar_crit=PLM_params;Mpar_crit.criterion=.8679     % criterion weight only
Mpar_crit = 
      rep_size: [7 5 1]
       max_act: 0.5000
      rep_gain: 0.8000
     rep_noise: 0.1000
     out_noise: 0.1950           % <-- left at PLExp1 default
      W_minmax: [-1 1]
        W_init: 0.1700
       W0_seed: [35x1 double]
    learn_rate: 0.0015
    runav_rate: 0.0200
     criterion: 0.8679           % <-- optimized to fit PLExp2
    fdbk_fract: 1
      blk_size: 300

%%% Run 10 epochs of 8*100 runs each -- takes about 7.5 hours on Dell OptiPlex
tic;N_runs=100;N_epochs=10;
for kk=1:N_epochs
  SpeedCompar1;
  dprime1(kk).N_runs=sst32fdbk_Mdecn.N_runs;dprime1(kk).fdbk32_Mdecn=sst32fdbk_Mdecn.dprime;dprime1(kk).fdbk32_Mcrit=sst32fdbk_Mcrit.dprime;dprime1(kk).fdbk36_Mdecn=sst36fdbk_Mdecn.dprime;dprime1(kk).fdbk36_Mcrit=sst36fdbk_Mcrit.dprime;dprime1(kk).nofk32_Mdecn=sst32nofk_Mdecn.dprime;dprime1(kk).nofk32_Mcrit=sst32nofk_Mcrit.dprime;dprime1(kk).nofk36_Mdecn=sst36nofk_Mdecn.dprime;dprime1(kk).nofk36_Mcrit=sst36nofk_Mcrit.dprime;
  zP_congr1(kk).N_runs=sst32fdbk_Mdecn.N_runs;zP_congr1(kk).fdbk32_Mdecn=sst32fdbk_Mdecn.zP_congr;zP_congr1(kk).fdbk32_Mcrit=sst32fdbk_Mcrit.zP_congr;zP_congr1(kk).fdbk36_Mdecn=sst36fdbk_Mdecn.zP_congr;zP_congr1(kk).fdbk36_Mcrit=sst36fdbk_Mcrit.zP_congr;zP_congr1(kk).nofk32_Mdecn=sst32nofk_Mdecn.zP_congr;zP_congr1(kk).nofk32_Mcrit=sst32nofk_Mcrit.zP_congr;zP_congr1(kk).nofk36_Mdecn=sst36nofk_Mdecn.zP_congr;zP_congr1(kk).nofk36_Mcrit=sst36nofk_Mcrit.zP_congr;
  zP_incon1(kk).N_runs=sst32fdbk_Mdecn.N_runs;zP_incon1(kk).fdbk32_Mdecn=sst32fdbk_Mdecn.zP_incon;zP_incon1(kk).fdbk32_Mcrit=sst32fdbk_Mcrit.zP_incon;zP_incon1(kk).fdbk36_Mdecn=sst36fdbk_Mdecn.zP_incon;zP_incon1(kk).fdbk36_Mcrit=sst36fdbk_Mcrit.zP_incon;zP_incon1(kk).nofk32_Mdecn=sst32nofk_Mdecn.zP_incon;zP_incon1(kk).nofk32_Mcrit=sst32nofk_Mcrit.zP_incon;zP_incon1(kk).nofk36_Mdecn=sst36nofk_Mdecn.zP_incon;zP_incon1(kk).nofk36_Mcrit=sst36nofk_Mcrit.zP_incon;
  save SpeedCompar1 dprime1 zP_congr1 zP_incon1 ; fprintf(' saved to SPEEDCOMPAR1.MAT\n');
end;toc


%%  Aggregate and plot
» load SpeedCompar     % add to the results of earlier simulations

adpr.fdbk32_Mdecn=mean(cat(3,dprime1(:).fdbk32_Mdecn),3);adpr.fdbk32_Mcrit=mean(cat(3,dprime1(:).fdbk32_Mcrit),3);
adpr.fdbk36_Mdecn=mean(cat(3,dprime1(:).fdbk36_Mdecn),3);adpr.fdbk36_Mcrit=mean(cat(3,dprime1(:).fdbk36_Mcrit),3);
adpr.nofk32_Mdecn=mean(cat(3,dprime1(:).nofk32_Mdecn),3);adpr.nofk32_Mcrit=mean(cat(3,dprime1(:).nofk32_Mcrit),3);
adpr.nofk36_Mdecn=mean(cat(3,dprime1(:).nofk36_Mdecn),3);adpr.nofk36_Mcrit=mean(cat(3,dprime1(:).nofk36_Mcrit),3);
aZc.fdbk32_Mdecn=mean(cat(3,zP_congr1(:).fdbk32_Mdecn),3);aZc.fdbk32_Mcrit=mean(cat(3,zP_congr1(:).fdbk32_Mcrit),3);
aZc.fdbk36_Mdecn=mean(cat(3,zP_congr1(:).fdbk36_Mdecn),3);aZc.fdbk36_Mcrit=mean(cat(3,zP_congr1(:).fdbk36_Mcrit),3);
aZc.nofk32_Mdecn=mean(cat(3,zP_congr1(:).nofk32_Mdecn),3);aZc.nofk32_Mcrit=mean(cat(3,zP_congr1(:).nofk32_Mcrit),3);
aZc.nofk36_Mdecn=mean(cat(3,zP_congr1(:).nofk36_Mdecn),3);aZc.nofk36_Mcrit=mean(cat(3,zP_congr1(:).nofk36_Mcrit),3);
aZi.fdbk32_Mdecn=mean(cat(3,zP_incon1(:).fdbk32_Mdecn),3);aZi.fdbk32_Mcrit=mean(cat(3,zP_incon1(:).fdbk32_Mcrit),3);
aZi.fdbk36_Mdecn=mean(cat(3,zP_incon1(:).fdbk36_Mdecn),3);aZi.fdbk36_Mcrit=mean(cat(3,zP_incon1(:).fdbk36_Mcrit),3);
aZi.nofk32_Mdecn=mean(cat(3,zP_incon1(:).nofk32_Mdecn),3);aZi.nofk32_Mcrit=mean(cat(3,zP_incon1(:).nofk32_Mcrit),3);
aZi.nofk36_Mdecn=mean(cat(3,zP_incon1(:).nofk36_Mdecn),3);aZi.nofk36_Mcrit=mean(cat(3,zP_incon1(:).nofk36_Mcrit),3);

» save SpeedCompar; whos
  Name            Size         Bytes  Class
---------------------------------------------------
  aZc             1x1          15172  struct array
  aZi             1x1          15172  struct array
  adpr            1x1          15172  struct array
  dprime          1x10         73928  struct array
  dprime1         1x10         73928  struct array
  zP_congr        1x10         73928  struct array
  zP_congr1       1x10         73928  struct array
  zP_incon        1x10         73928  struct array
  zP_incon1       1x10         73928  struct array
---------------------------------------------------

» adpr
adpr = 
          N_runs: 1000
    fdbk32_Mfdbk: [32x3 double]
    fdbk32_Mnofk: [32x3 double]
    fdbk36_Mfdbk: [36x3 double]
    fdbk36_Mnofk: [36x3 double]
    nofk32_Mfdbk: [32x3 double]
    nofk32_Mnofk: [32x3 double]
    nofk36_Mfdbk: [36x3 double]
    nofk36_Mnofk: [36x3 double]
    fdbk32_Mdecn: [32x3 double]
    fdbk32_Mcrit: [32x3 double]
    fdbk36_Mdecn: [36x3 double]
    fdbk36_Mcrit: [36x3 double]
    nofk32_Mdecn: [32x3 double]
    nofk32_Mcrit: [32x3 double]
    nofk36_Mdecn: [36x3 double]
    nofk36_Mcrit: [36x3 double]

%-- Plot the d-primes. 'o-'=trial-by-trial fdbk, '.-'=no fdbk, same stimuli, same parameters
subplot(2,2,1);t=[1:32]';plot(t,adpr.fdbk32_Mcrit,'bo-',t,adpr.nofk32_Mcrit,'.r-');axis([0 37 0 3.5]);set(gca,'xtick',[0:4:36]);grid on;title('onoise=0.195, crit=0.868');ylabel('d''');
subplot(2,2,2);t=[1:36]';plot(t,adpr.fdbk36_Mcrit,'bo-',t,adpr.nofk36_Mcrit,'.r-');axis([0 37 0 3.5]);set(gca,'xtick',[0:4:36]);grid on;title('onoise=0.195, crit=0.868');ylabel('d''');
subplot(2,2,3);t=[1:32]';plot(t,adpr.fdbk32_Mdecn,'bo-',t,adpr.nofk32_Mdecn,'.r-');axis([0 37 0 3.5]);set(gca,'xtick',[0:4:36]);grid on;title('onoise=0.1578, crit=2.20');ylabel('d''');
subplot(2,2,4);t=[1:36]';plot(t,adpr.fdbk36_Mdecn,'bo-',t,adpr.nofk36_Mdecn,'.r-');axis([0 37 0 3.5]);set(gca,'xtick',[0:4:36]);grid on;title('onoise=0.1578, crit=2.20');ylabel('d''');

%-- Z-probability plots
subplot(2,2,1);t=[1:32]';plot(t,aZc.fdbk32_Mcrit,'bo-',t,aZc.nofk32_Mcrit,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('congr stim, onoise=0.195, crit=0.868');ylabel('zPcorrect');
subplot(2,2,2);t=[1:36]';plot(t,aZc.fdbk36_Mcrit,'bo-',t,aZc.nofk36_Mcrit,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('congr stim, onoise=0.195, crit=0.868');ylabel('zPcorrect');
subplot(2,2,3);t=[1:32]';plot(t,aZc.fdbk32_Mdecn,'bo-',t,aZc.nofk32_Mdecn,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('congr stim, onoise=0.1578, crit=2.20');ylabel('zPcorrect');
subplot(2,2,4);t=[1:36]';plot(t,aZc.fdbk36_Mdecn,'bo-',t,aZc.nofk36_Mdecn,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('congr stim, onoise=0.1578, crit=2.20');ylabel('zPcorrect');

subplot(2,2,1);t=[1:32]';plot(t,aZi.fdbk32_Mcrit,'bo-',t,aZi.nofk32_Mcrit,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('incongr stim, onoise=0.195, crit=0.868');ylabel('zPcorrect');
subplot(2,2,2);t=[1:36]';plot(t,aZi.fdbk36_Mcrit,'bo-',t,aZi.nofk36_Mcrit,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('incongr stim, onoise=0.195, crit=0.868');ylabel('zPcorrect');
subplot(2,2,3);t=[1:32]';plot(t,aZi.fdbk32_Mdecn,'bo-',t,aZi.nofk32_Mdecn,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('incongr stim, onoise=0.1578, crit=2.20');ylabel('zPcorrect');
subplot(2,2,4);t=[1:36]';plot(t,aZi.fdbk36_Mdecn,'bo-',t,aZi.nofk36_Mdecn,'.r-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);grid on;title('incongr stim, onoise=0.1578, crit=2.20');ylabel('zPcorrect');

% interleaved among the ealier three plots in C:\work\PLPaper2\simul\SpCompDpr.pdf

*****************************************************************************

Date: Sun, 12 Jun 2005 13:41:49 -0700
To: Barbara Dosher <bdosher@uci.edu>, Zhong-Lin Lu <zhonglin@usc.edu>
From: Alexander Petrov <apetrov@uci.edu>
Subject: More simulation results

Dear Barbara and Zhong-Lin,

I doubled-checked my program and didn't find any mistakes in the simulations. While the probability of a programming error never goes to 0.0, I believe it is quite low in this case.

Per Barbara's suggestion, I also ran two new simulations, varying only one parameter at a time.  The resulting figures are included.  (The file SpeedCompar.pdf  interleaves plots under all 4 parameter sets tested.)

We have thus tested 4 parameter sets.  The two parameters that vary are the decision noise (sigma_d in Eq. 10) and the bias strength parameter alpha in Eq. 15.
  *  feedback params:   out_noise = .195,  criterion = 2.20
  *  out_noise = .195, criterion = 0.868
  *  out_noise = .158, criterion = 2.20
  *  no-feedback params:  out_noise = .158, criterion = 0.868

Both parameters affect the asymptotic d's, as follows:
  (a)  when out_noise decreases, d' increases for obvious reasons
  (b)  when the bias strength decreases, d' increases because there are less sequential effects.  (Sequential effects tend to erode the accuracy.)

Factor (a) appears approximately twice as strong as factor (b), but the latter is also quite noticeable.  Both effects are there both with and without feedback.  They are much more pronounced without feedback, of course.

Have you had a chance to look over the draft that I sent you nearly a week ago?  I'm afraid we're running out of time...

-- Alex

[SpeedCompar.pdf]



****************************************************************************
******
******  15 June 2005 -- Probabilistic feedback: 33% and 66%
******


» cd('C:\work\PLPaper2\simul');  % or C:\users\apetrov\PLPaper2\simul

» clear all;load('..\..\PLModel1\PLM_CACHE.mat');load('..\..\PLExp2\modelfits\sched36.mat');

» Mpar_fdbk=PLM_params;Mpar_fdbk.fdbk_fract = 1/3
Mpar_fdbk = 
      rep_size: [7 5 1]
       max_act: 0.5000
      rep_gain: 0.8000
     rep_noise: 0.1000
     out_noise: 0.1950
      W_minmax: [-1 1]
        W_init: 0.1700
       W0_seed: [35x1 double]
    learn_rate: 0.0015
    runav_rate: 0.0200
     criterion: 2.2000
    fdbk_fract: 0.3333         % <-- Sic!
      blk_size: 300

» Mpar_nofk=Mpar_fdbk;Mpar_nofk.out_noise=.1578;Mpar_nofk.criterion=.8679;Mpar_nofk.fdbk_fract=1/3
Mpar_nofk = 

      rep_size: [7 5 1]
       max_act: 0.5000
      rep_gain: 0.8000
     rep_noise: 0.1000
     out_noise: 0.1578
      W_minmax: [-1 1]
        W_init: 0.1700
       W0_seed: [35x1 double]
    learn_rate: 0.0015
    runav_rate: 0.0200
     criterion: 0.8679
    fdbk_fract: 0.3333         % <-- Sic!
      blk_size: 300

%%% Run 10+10 epochs of 4*100 runs each. Takes 4+4 hours on a Dell OptiPlex
tic;N_runs=100;N_epochs=10;
for kk=1:N_epochs
  SpeedCompar2;
  dprime(kk).N_runs=sst36fdbk_Mfdbk.N_runs;
  dprime(kk).fdbk36_Mfdbk33=sst36fdbk_Mfdbk.dprime;dprime(kk).fdbk36_Mnofk33=sst36fdbk_Mnofk.dprime;
  dprime(kk).nofk36_Mfdbk33=sst36nofk_Mfdbk.dprime;dprime(kk).nofk36_Mnofk33=sst36nofk_Mnofk.dprime;
  zP_congr(kk).N_runs=sst36fdbk_Mfdbk.N_runs;
  zP_congr(kk).fdbk36_Mfdbk33=sst36fdbk_Mfdbk.zP_congr;zP_congr(kk).fdbk36_Mnofk33=sst36fdbk_Mnofk.zP_congr;
  zP_congr(kk).nofk36_Mfdbk33=sst36nofk_Mfdbk.zP_congr;zP_congr(kk).nofk36_Mnofk33=sst36nofk_Mnofk.zP_congr;
  zP_incon(kk).N_runs=sst36fdbk_Mfdbk.N_runs;
  zP_incon(kk).fdbk36_Mfdbk33=sst36fdbk_Mfdbk.zP_incon;zP_incon(kk).fdbk36_Mnofk33=sst36fdbk_Mnofk.zP_incon;
  zP_incon(kk).nofk36_Mfdbk33=sst36nofk_Mfdbk.zP_incon;zP_incon(kk).nofk36_Mnofk33=sst36nofk_Mnofk.zP_incon;
  save SpeedCompar33 dprime zP_congr zP_incon ; fprintf(' saved to SPEEDCOMPAR33.MAT\n');
end;toc
Mpar_fdbk.fdbk_fract=2/3;Mpar_nofk.fdbk_fract=2/3;tic
for kk=1:N_epochs
  SpeedCompar2;
  dprime(kk).fdbk36_Mfdbk66=sst36fdbk_Mfdbk.dprime;dprime(kk).fdbk36_Mnofk66=sst36fdbk_Mnofk.dprime;
  dprime(kk).nofk36_Mfdbk66=sst36nofk_Mfdbk.dprime;dprime(kk).nofk36_Mnofk66=sst36nofk_Mnofk.dprime;
  zP_congr(kk).fdbk36_Mfdbk66=sst36fdbk_Mfdbk.zP_congr;zP_congr(kk).fdbk36_Mnofk66=sst36fdbk_Mnofk.zP_congr;
  zP_congr(kk).nofk36_Mfdbk66=sst36nofk_Mfdbk.zP_congr;zP_congr(kk).nofk36_Mnofk66=sst36nofk_Mnofk.zP_congr;
  zP_incon(kk).fdbk36_Mfdbk66=sst36fdbk_Mfdbk.zP_incon;zP_incon(kk).fdbk36_Mnofk66=sst36fdbk_Mnofk.zP_incon;
  zP_incon(kk).nofk36_Mfdbk66=sst36nofk_Mfdbk.zP_incon;zP_incon(kk).nofk36_Mnofk66=sst36nofk_Mnofk.zP_incon;
  save SpeedCompar66 dprime zP_congr zP_incon ; fprintf(' saved to SPEEDCOMPAR66.MAT\n');
end;toc

% Rename variables: dprime-->dprime33, zP_congr-->zP_congr33, zP_incon-->zP_incon

%%  Aggregate and plot
» load SpeedCompar     % add to the results of earlier simulations

adpr.fdbk36_Mfdbk33=mean(cat(3,dprime33(:).fdbk36_Mfdbk33),3);adpr.fdbk36_Mnofk33=mean(cat(3,dprime33(:).fdbk36_Mnofk33),3);
adpr.nofk36_Mfdbk33=mean(cat(3,dprime33(:).nofk36_Mfdbk33),3);adpr.nofk36_Mnofk33=mean(cat(3,dprime33(:).nofk36_Mnofk33),3);
aZc.fdbk36_Mfdbk33=mean(cat(3,zP_congr33(:).fdbk36_Mfdbk33),3);aZc.fdbk36_Mnofk33=mean(cat(3,zP_congr33(:).fdbk36_Mnofk33),3);
aZc.nofk36_Mfdbk33=mean(cat(3,zP_congr33(:).nofk36_Mfdbk33),3);aZc.nofk36_Mnofk33=mean(cat(3,zP_congr33(:).nofk36_Mnofk33),3);
aZi.fdbk36_Mfdbk33=mean(cat(3,zP_incon33(:).fdbk36_Mfdbk33),3);aZi.fdbk36_Mnofk33=mean(cat(3,zP_incon33(:).fdbk36_Mnofk33),3);
aZi.nofk36_Mfdbk33=mean(cat(3,zP_incon33(:).nofk36_Mfdbk33),3);aZi.nofk36_Mnofk33=mean(cat(3,zP_incon33(:).nofk36_Mnofk33),3);
adpr.fdbk36_Mfdbk66=mean(cat(3,dprime33(:).fdbk36_Mfdbk66),3);adpr.fdbk36_Mnofk66=mean(cat(3,dprime33(:).fdbk36_Mnofk66),3);
adpr.nofk36_Mfdbk66=mean(cat(3,dprime33(:).nofk36_Mfdbk66),3);adpr.nofk36_Mnofk66=mean(cat(3,dprime33(:).nofk36_Mnofk66),3);
aZc.fdbk36_Mfdbk66=mean(cat(3,zP_congr33(:).fdbk36_Mfdbk66),3);aZc.fdbk36_Mnofk66=mean(cat(3,zP_congr33(:).fdbk36_Mnofk66),3);
aZc.nofk36_Mfdbk66=mean(cat(3,zP_congr33(:).nofk36_Mfdbk66),3);aZc.nofk36_Mnofk66=mean(cat(3,zP_congr33(:).nofk36_Mnofk66),3);
aZi.fdbk36_Mfdbk66=mean(cat(3,zP_incon33(:).fdbk36_Mfdbk66),3);aZi.fdbk36_Mnofk66=mean(cat(3,zP_incon33(:).fdbk36_Mnofk66),3);
aZi.nofk36_Mfdbk66=mean(cat(3,zP_incon33(:).nofk36_Mfdbk66),3);aZi.nofk36_Mnofk66=mean(cat(3,zP_incon33(:).nofk36_Mnofk66),3);

» save SpeedCompar; whos
  Name            Size         Bytes  Class
---------------------------------------------------
  aZc              1x1          23076  struct array
  aZi              1x1          23076  struct array
  adpr             1x1          23076  struct array
  dprime           1x10         73928  struct array
  dprime1          1x10         73928  struct array
  dprime33         1x10         77768  struct array
  zP_congr         1x10         73928  struct array
  zP_congr1        1x10         73928  struct array
  zP_congr33       1x10         77768  struct array
  zP_incon         1x10         73928  struct array
  zP_incon1        1x10         73928  struct array
  zP_incon33       1x10         77768  struct array
---------------------------------------------------

» adpr
adpr =      N_runs: 1000
      fdbk32_Mfdbk: [32x3 double]
      fdbk32_Mnofk: [32x3 double]
      fdbk36_Mfdbk: [36x3 double]
      fdbk36_Mnofk: [36x3 double]
      nofk32_Mfdbk: [32x3 double]
      nofk32_Mnofk: [32x3 double]
      nofk36_Mfdbk: [36x3 double]
      nofk36_Mnofk: [36x3 double]
      fdbk32_Mdecn: [32x3 double]
      fdbk32_Mcrit: [32x3 double]
      fdbk36_Mdecn: [36x3 double]
      fdbk36_Mcrit: [36x3 double]
      nofk32_Mdecn: [32x3 double]
      nofk32_Mcrit: [32x3 double]
      nofk36_Mdecn: [36x3 double]
      nofk36_Mcrit: [36x3 double]
    fdbk36_Mfdbk33: [36x3 double]
    fdbk36_Mnofk33: [36x3 double]    % <-- identical with fdbk36_Mnofk
    nofk36_Mfdbk33: [36x3 double]
    nofk36_Mnofk33: [36x3 double]    % <-- identical with nofk36_Mnofk
    fdbk36_Mfdbk66: [36x3 double]
    fdbk36_Mnofk66: [36x3 double]    % <-- identical with fdbk36_Mnofk
    nofk36_Mfdbk66: [36x3 double]
    nofk36_Mnofk66: [36x3 double]    % <-- identical with nofk36_Mnofk


%-- Plot the d-primes. 'o-'=trial-by-trial fdbk, '.-'=no fdbk, same stimuli, same parameters
subplot(2,1,1);t=[1:36]';plot(t,adpr.fdbk36_Mfdbk,'.r-',t,adpr.fdbk36_Mfdbk66,'b-',t,adpr.fdbk36_Mfdbk33,'g-',t,adpr.nofk36_Mfdbk,'k-');axis([0 37 0 3.5]);set(gca,'xtick',[0:4:36]);title('Fdbk on 0,33,66,100% of trials. Fdbk params');ylabel('d''');
subplot(2,1,2);t=[1:36]';plot(t,adpr.fdbk36_Mnofk,'.r-',t,adpr.fdbk36_Mnofk66,'b-',t,adpr.fdbk36_Mnofk33,'g-',t,adpr.nofk36_Mnofk,'k-');axis([0 37 0 3.5]);set(gca,'xtick',[0:4:36]);title('Fdbk on 0,33,66,100% of trials. No-fdbk params');ylabel('d''');

%-- Z-probability plots
subplot(2,2,1);t=[1:36]';plot(t,aZc.fdbk36_Mfdbk,'.r-',t,aZc.fdbk36_Mfdbk66,'b-',t,aZc.fdbk36_Mfdbk33,'g-',t,aZc.nofk36_Mfdbk,'k-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);title('Congr stim, Fdbk params');ylabel('zPcorrect');
subplot(2,2,3);t=[1:36]';plot(t,aZc.fdbk36_Mnofk,'.r-',t,aZc.fdbk36_Mnofk66,'b-',t,aZc.fdbk36_Mnofk33,'g-',t,aZc.nofk36_Mnofk,'k-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);title('Congr stim, No-fdbk params');ylabel('zPcorrect');
subplot(2,2,2);t=[1:36]';plot(t,aZi.fdbk36_Mfdbk,'.r-',t,aZi.fdbk36_Mfdbk66,'b-',t,aZi.fdbk36_Mfdbk33,'g-',t,aZi.nofk36_Mfdbk,'k-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);title('Incongr stim, Fdbk params');ylabel('zPcorrect');
subplot(2,2,4);t=[1:36]';plot(t,aZi.fdbk36_Mnofk,'.r-',t,aZi.fdbk36_Mnofk66,'b-',t,aZi.fdbk36_Mnofk33,'g-',t,aZi.nofk36_Mnofk,'k-');axis([0 37 -1 2]);set(gca,'xtick',[0:4:36]);title('Incongr stim, No-fdbk params');ylabel('zPcorrect');

% saved as C:\work\PLPaper2\simul\FractionalFdbk.pdf
