R package for fitting Response-Time extended Multinomial Processing Tree (RT-MPT) models by Klauer and Kellen (2018)
The model class RT-MPT incorporate response frequencies and response latencies. This enables the estimation of
- process-completion times: the time a process takes
- encoding plus motor execution times (aka non-decision times): the time for encoding a stimuli plus executing the response
- process-probabilities: the probability with which a process occures (as in traditional MPTs).
In total we have for each process one probability parameter and two process completion times (for each outcome of the process one).
rtmpt has two sub-model classes: the exponential RT-MPT uses a Metropolis-within-Gibbs sampler and builds on the C++ code by Klauer and Kellen (2018) with some modifications. The diffusion RT-MPT uses a Hamiltonian-Within-Gibbs sampler and builds on the C++ code by Klauer, Hartmann, and Meyer-Grant (submitted manuscript).
In the exponential RT-MPT (short ertmpt) model class it is possible to
- set process probabilities to constants
- set two or more probabilities equal
- set the process completion time of one process outcome to zero
- set the process completion time of multiple processes with the same outcome (+ or -) equal
In the diffusion RT-MPT (short drtmpt) model class it is possible to
- set one or more of the diffusion parameters (threshold, drift rate, and relative starting point) for a process to constants
- set one or more of the diffusion parameters (threshold, drift rate, and relative starting point) for multiple processes equal
For more information about the functionalities check the help files or the vignette of the package.
An installation via CRAN is now possible. Write in the command line in R:
install.packages("rtmpt")
Before installing the R package rtmpt you need to install the latest version of the GNU Scientific Library (GSL):
- Download the latest
*tar.gzfile from GSL - Unzip the file
- Assuming you downloaded version 2.5 and unziped the file to ~/Downloads/gsl-2.5, open terminal and change directory via
$ cd ~/Downloads/gsl-2.5 - Execute the following lines:
./configure make sudo make install
For some Linux distributions it is necessary to run sudo ldconfig -v in the terminal before installing rtmpt.
Installing rtmpt is possible either
-
with the R package devtools and the command
devtools::install_github("RaphaelHartmann/rtmpt@master")in R or -
with the following steps:
-
Download all the source files from the
rtmptpackage above -
In the terminal change directory via
$ cd ~/Downloads(assuming the rtmpt source folder is in /Downloads) -
Execute:
R CMD build rtmpt R CMD INSTALL rtmpt_<XYZ>.tar.gzwhere XYZ stands for the version number.
-
Before installing the R package rtmpt from source you need to do the following:
- If not already installed, install Homebrew
- Install GSL via Homebrew using terminal and command
brew install gsl - Install Xcode from the App Store and then install the Command Line Tools using
xcode-select --install - If you use MacOS Mojave, make sure to also run the following command:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg - Also execute
brew install gccin your terminal. - Check via
ls /usr/local/bin/what endings the gcc/g++ executables have (in my case -9) - If
~/.R/Makevarsdoes not already exist, create it withmkdir ~/.R/andtouch ~/.R/Makevars - Use
open ~/.R/Makevarsto write the following in the Makevars file (assuming your gcc/g++ executables have the ending -9):and save.CC=/usr/local/bin/gcc-9 CXX=/usr/local/bin/g++-9 CXX11=/usr/local/bin/g++-9
Installing the rtmpt package:
This is possible either
-
with the R package devtools and the command
devtools::install_github("RaphaelHartmann/rtmpt@master")in R or -
with the following steps:
-
Download all the source files from the
rtmptpackage above -
In the terminal change directory via
$ cd ~/Downloads(assuming the rtmpt source folder is in /Downloads) -
Execute:
R CMD build rtmpt R CMD INSTALL rtmpt_<XYZ>.tar.gzwhere XYZ stands for the version number.
-
If you want to cite this package write
Hartmann, R., Johannsen, L., & Klauer, K. C. (2020). rtmpt: An R package for fitting response-time extended multinomial processing tree models. Behavior Research Methods, 52(3), 1313–1338. doi: 10.3758/s13428-019-01318-x
or use the BibTeX code:
@article{Hartmann_2020,
doi = {10.3758/s13428-019-01318-x},
url = {https://doi.org/10.3758%2Fs13428-019-01318-x},
year = 2020,
month = {may},
publisher = {Springer Science and Business Media {LLC}},
volume = {52},
number = {3},
pages = {1313--1338},
author = {Raphael Hartmann and Lea Johannsen and Karl Christoph Klauer},
title = {rtmpt: An R package for fitting response-time extended multinomial processing tree models},
journal = {Behavior Research Methods}
}
Klauer, K. C., & Kellen, D. (2018). RT-MPTs: Process models for response-time distributions based on multinomial processing trees with applications to recognition memory. Journal of Mathematical Psychology, 82, 111-130. 111–130. doi: 10.1016/j.jmp.2017.12.003
Hartmann, R., Johannsen, L., & Klauer, K. C. (2020). rtmpt: An R package for fitting response-time extended multinomial processing tree models. Behavior Research Methods, 52(3), 1313–1338. doi: 10.3758/s13428-019-01318-x
Hartmann, R., & Klauer, K. C. (2020). Extending RT-MPTs to enable equal process times. Journal of Mathematical Psychology, 96, 102340. doi: 10.1016/j.jmp.2020.102340
Galassi, M., Davies, J., Theiler, J., Gough, B., Jungman, G., Alken, P., . . . Ulerich, R. (2018). GNU scientific library [Computer software]. Retrieved from http://www.gnu.org/software/gsl/