% ANCHOR Model Implementation
% Version 2.2 2007-04-01
%
% This toolbox implements the ANCHOR model of category rating and
% absolute identification (Petrov & Anderson, 2000, 2005).
% ANCHOR is a memory-based model that features a competitive learning
% mechanism and an explicit correction mechanism. It accounts for over
% a dozen empirical phenomena in category rating and absolute
% identification (Petrov & Anderson, 2005).
%
% The functions in the ANCHOR directory implement the model itself and
% provide tools for fitting it to individual data (Petrov, 2001).
% The FINALSIM subdirectory provides tools for analysing the
% stimulus-response sequences generated by the model and comparing them
% to human data. The FINALSIM/HIER subdirectory contains the simulation
% results with a hierarchy of nested models on a battery of measures of
% various phenomena. These results are reported in Table 4 of Petrov &
% Anderson (2005) and are provided here as a research-grade example of how
% to use the ANCHOR software.
%
% This software is distributed under the GNU General Public License and
% can be downloaded free from http://alexpetrov.com/softw/anchor/
% It depends on the UTILS Toolbox, http://alexpetrov/softw/utils/
% See README.TXT and ANCHOR_LICENSE.M for details.
%
% Functions:
%  anchor2 - ANCHOR cognitive model of psychophysical scaling, ver 2.2
%  anchor_params   -  Default parameters for the ANCHOR2 model
%  default_anchors - Initial anchor configuration for the ANCHOR model
%  anchor2log - Log-keeping version of the ANCHOR2 cognitive model
%  anchor2mt  - Model-tracer for the ANCHOR2 cognitive model (Petrov, 2001)
%  B_approx2  - Efficient approximation of base-level learning equation
%  anchor_search_params - Parameters for ANCHOR parameter search
%  anchor_template - Templates for parameter search for ANCHOR model
%  anchor_license - ANCHOR comes under GNU General Public License
%
% Example of basic model usage:
%  stim = [275:50:675]'; params = anchor_params ; fdbk = [1:9]' ;
%  resp = anchor2(stim,params) ; plot(stim,resp,'o') ;
%  respAI = anchor2(stim,params,fdbk); plot(fdbk,respAI,'s') ;
%
% Example of research-grade model usage, see FINALSIM/Contents.m
%  stim_params=struct('N_runs',[100 100],'schedule',[101 102]) ;
%  stim = generate_stimuli(stim_params) ; params=anchor_params ;
%  mresp=anchor2(stim,params) ;  % Generate 200 sequences of length 450
%  mstats=CR_stats(stim,mresp);d=mstats.context;d(101:200)=-d(101:200);
%  sumstats = CR_summary(mstats)
%
% Example of a parameter fitting session for a given <stim,resp> data set.
% Depends on UTILS/PARAMSEARCH and Matlab's Optimization Toolbox.
%   model_data = struct('stim',stim,'resp',resp) ;
%   Sparams = anchor_search_params
%   Sparams.params.xxxxx = tweak whatever initial values you like ...
%   [opt_params,L] = paramsearch(model_data,Sparams)
% Type 'helpwin big_psearch' for details on batch fitting.
%
% References:
%   * Petrov, A. A. & Anderson, J. R. (2005). The Dynamics of Scaling: 
%     A Memory-Based Anchor Model of Category Rating and Absolute 
%     Identification. Psychological Review, 112(2), 383-416.
%     http://alexpetrov.com/pub/biganchor/
%
%   * Petrov, A. (2003). Additive or Multiplicative Perceptual Noise?
%     Two Equivalent Forms of the ANCHOR Model. In R. Alterman & D. Kirsh
%     (Eds.), Proceedings of the Twenty-Fifth Annual Conference the
%     Cognitive Science Society (pp. 922-927). Hillsdale, NJ: LEA.
%     http://alexpetrov.com/pub/anchor03/
%
%   * Petrov, A.  (2001). Fitting the ANCHOR Model to Individual Data:
%     A Case Study in Bayesian Methodology. In E. M. Altmann, 
%     A. Cleeremans, C. D. Schunn, & W. D. Gray (Eds.), Proceedings of 
%     the 2001 Fourth International Conference on Cognitive Modeling 
%     (pp. 175-180). Mahwah, NJ: LEA. http://alexpetrov.com/pub/anchor01/
%
%   * Petrov, A. (2006). Computationally efficient approximation of the
%     base-level learning equation in ACT-R. In D. Fum, F. Del Missier, & 
%     A. Stocco (Eds.), Proceedings of the Seventh International Conference 
%     on Cognitive Modeling (pp. 391-392). Trieste, Italy: Edizioni Goliardiche.
%     http://alexpetrov.com/pub/iccm06/
%
% See also FINALSIM, PARAMSEARCH, BIG_PSEARCH, OPTIM.
%
% Original coding by Alex Petrov, Ohio State University
% $Revision: 2.2 $  $Date: 2007/04/01 $
%
% Part of the ANCHOR Model Implementation v.2.2 for MATLAB version 5 and up.
% http://alexpetrov.com/proj/anchor/
% Copyright (c) Alexander Petrov 1999-2007, http://alexpetrov.com
% Please read the LICENSE and NO WARRANTY statement in anchor_license.m

