Cognitivemodels is an R packages that provides a number of cognitive models, using a formula interface similar to the
lm-syntax. The models can be fit to data by maximum likelihood, minimum MSE, and more fit measures using optimization routines like rsolnp or Nelder-Mead, and various others. Also, the package provides a model development back end: a class that you can use to develop new cognitive models easily.
For new features in the latest package version, see NEWS.
To use this package, ensure you have a working installation of R and the Rcpp package,
install.packages("Rcpp"), for problems see Installation Troubleshooting
if (!require(pacman)) install.packages(pacman) update.package("matlib") # needed pacman::p_load(devtools) pacman::p_load_gh("janajarecki/cognitivemodels")
You will see a prompt, please type
Yes into the console.
Do you want to install from sources the packages which need compilation? (Yes/no/cancel)
(Optional) This installs the latest development version of the package:
To use the package:
Here are some error messages during the installation and how to troubleshoot them:
Failed to install 'cognitivemodels' from GitHub: Could not find tools necessary to compile a package Callpkgbuild::check_build_tools(debug = TRUE)
to diagnose the problem.Solution: In R, you must run
options(buildtools.check = function(action) TRUE )to solve the problem, more details see here
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:Solution You need to install xcode which you do on Mac by opening the terminal and running
xcode-select --installto install the command lines tools package more details on stackoverflow
The following models are implemented:
Model | Reference | Documentation of the Function
------------ | ------------- | -------------
Memory-based preference model | Jarecki & Rieskamp (submitted) |
Generalized context model | Medin & Schaffer (1976); Nosofsky (1986) |
Optimal risk-sensitive foraging model | Houston & McNamara (1988) |
Cumulative prospect theory | Kahneman & Tversky (1979); Tversky & Kahneman (1992) |
Bayesian cognitive model | Hoffart, Jarecki, Duthil, & Rieskamp (under review) |
Power utility | Tversky (1967); Wakker (2008)|
Soft-max choice rule | Sutton & Barto (1998) |
Arg-max choice rule | |
Epsilon-greedy choice rule | |
Baseline model | |
Shortfall model | Andraszewicz (2014) |
Jana B. Jarecki, Florian I. Seitz
This project is licensed under CC-By Attribution 4.0 International
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.