Skip to content

Latest commit

 

History

History
112 lines (95 loc) · 4.45 KB

File metadata and controls

112 lines (95 loc) · 4.45 KB

Model fitting and simulations

These Julia scripts perform model fitting and model simulations. All the provided commands need to be run in a terminal in this folder. The resulting fit data is written to the ../fitdata folder.

Model fitting

Model fitting is performed by the fitmodel.jl script. This script is called by

julia --project=. fitmodel.jl [model] [objfn] [[ratid]]

Upon completion, it writes the found fit parameters to

../fitdata/fits/fit_[model]_[objfn]_[[ratid]].csv

The script takes the following arguments. [model] specifies the model to be fitted. [objfn] specifies the objective function that measures the quality of the fit. [ratid] (optional; 1-4) specifies the identifier of the rat to fit. If [ratid] is omitted, the data of all rats is collapsed into a single rat.

The script supports the following [model] identifiers:

opt
optlapse
optcollapse
optbiaslapse
optcolbiaslapse
adflapse
adfcollapse
adfbiaslapse
adfcolbiaslapse
randomcollapse
randomcolbiaslapse
gammalapse
gammacollapse
gammabiaslapse
gammacolbiaslapse
deltalapse
deltacollapse
deltabiaslapse
deltacolbiaslapse
deltaexpcolbiaslapse
lcalapse
lcacollapse

The first part of the model identifier determines weight learning. opt uses the optimal weights, adf learns them by assumed density filtering, random varies them randomly across trials, gamma learns them by the heuristic learning rule descriped in the paper, delta learns them by the delta rule, and lca uses LCA. lapses models include lapses, col/expcol include (linearly/exponentially) collapsing boundaries, and bias include bias learning. More details on the specific models and their implementation can be found in models.jl.

The [objfn] can be one of

psychchron1
psychchron1ident
psychchron1categ
psychchron2
psychchron3
psychchronseq1
psychchronseq2
psychchronseq3
psychchron1itlvd
psychchron1itlvdedge

The first part of this identifier specifies the overall objective. A trailing ident, categ, itlvd, itlvdedge indicates that only the identification / categorization / interleaved / interleaved (only edge trials) condition is fit. If the identifier contains seq, the objective function aims to fit sequential choice dependencies. For the paper, the psychchron1 objective was used. More details about the different objective functions and their implementation can be found in modelfitting.jl.

Generate simulated behavior (for subsequent plotting)

Once a model has been fitted, its behavior can be simulated by calling

julia --project=. genmodelsims.jl [model] [objfn] [[ratid]] [[extendedstats]]

For objective functions fitting the identification and categorization conditions, the simulated behavior is written to the files

../fitdata/fits/[model]_[objfn]_[[ratid]]_ident.mat
../fitdata/fits/[model]_[objfn]_[[ratid]]_categ.mat

For objective functions fitting the interleaved condition, the simulated behavior is written to

../fitdata/modelsims/[model]_[objfn]_[[ratid]]_itlvd.mat

The [model], [objfn] and [ratid] (optional) arguments are the same as for the fitmodel.jl script, described above. If [[extendedstats]] (optional) is given and evaluates to true, then additional statistics are added to the data file.

Model fit diagnostics and model comparison

To get overall statistics on the model fit quality and perform model comparison, call

julia --project=. modelfitstats.jl

Please note that this script requires all models to have been fit with all psychchron1 objective functions for all rats.

Significantly more detailed fit statistics and model comparison plots are available through

julia --project=. modelfitstats_indvrats.jl

This script writes the plots and various MATLAB files containing fit quality metrics to ../fitdata/fits/.

Generating diagnostic plots

Even though all plots provided in the paper are generated by MATLAB, we here also provide some additional diagnostic plot scripts in Julia.

To plot the psychometric and chronometric curves from behavioral data, call

julia --project=. plotbehavior.jl

To plot the fit of a particular model, call

julia --project=. plotmodel.jl [args]

For a list of arguments, please consult the script's source code.

To plot the fit to the interleaved condition, call

julia --project=. plotmodelitlvd.jl [args]

For a list of arguments, please consult the script's source code.

All plots are written to ../fitdata/fits/.