Cognitivemodels is an R packages that provides a number of cognitive models, using a formula interface similar to the aov
- or 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
library(devtools)
install.packages("matlib")
install.packages("Rcpp")
# ---------------------------------------------
# Restart the R session after installing matlib
# ----------------------------------------------
devtools::install_github("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:
devtools::install_github("janajarecki/cognitivemodels" ref = "development")
To use the package:
library(cognitivemodels)
Here are some error messages during the installation and how to troubleshoot them:
- Error:
Failed to install 'cognitivemodels' from GitHub: Could not find tools necessary to compile a package Call
pkgbuild::check_build_tools(debug = TRUE)to diagnose the problem.
Solution: In R, you must runoptions(buildtools.check = function(action) TRUE )
to solve the problem, more details see here - Error:
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 runningxcode-select --install
to 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) | ?mem |
Generalized context model | Medin & Schaffer (1976); Nosofsky (1986) | ?ebm |
Optimal risk-sensitive foraging model | Houston & McNamara (1988) | ?hm1988 |
Cumulative prospect theory | Kahneman & Tversky (1979); Tversky & Kahneman (1992) | ?cpt |
Bayesian cognitive model | Hoffart, Jarecki, Duthil, & Rieskamp (under review) | ?bayes |
Power utility | Tversky (1967); Wakker (2008) | ?utility_pow |
Soft-max choice rule | Sutton & Barto (1998) | ?softmax |
Arg-max choice rule | ?argmax |
|
Epsilon-greedy choice rule | ?epsilon |
|
Baseline model | ?baseline |
|
Shortfall model | Andraszewicz (2014) | ?shortfall |
Jana B. Jarecki,
Florian I. Seitz
This project is licensed under CC-By Attribution 4.0 International