RegDDM
Build Regression models over Drift Diffusion Model parameters using MCMC!
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.9%) to scientific vocabulary
Last synced: 9 months ago
·
JSON representation
Repository
Build Regression models over Drift Diffusion Model parameters using MCMC!
Basic Info
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Created about 2 years ago
· Last pushed 12 months ago
Metadata Files
Readme
License
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# RegDDM
Build Regression models over Drift Diffusion Model parameters using MCMC!
## Installation
You can install latest version of `RegDDM` from CRAN:
``` r
install.packages("RegDDM")
```
For RStudio users, you may need the following:
```r
install.packages("rstudioapi")
```
## Example
First, load the package and the example dataset.
```{r example}
library(RegDDM)
data(regddm_data)
```
`data1` is the subject-level dataset:
```{r}
head(regddm_data$data1)
```
`data2` is the subject-level dataset:
```{r}
head(regddm_data$data2)
```
Specify the model using a list. In this example, the drift rate `v` is influenced by `memload`, which is the memory load of the trial. The subject's `iq` is predicted by baseline drift rate `v_0` (drift rate when `memload` is 0), the influence of `memload` on drift rate `v_memload` and covariates `age` and `education`:
```{r}
model = list(
v ~ memload,
iq ~ v_memload + v_0 + age + education
)
```
Use the main function of `RegDDM` to automatically generate the `RStan` model and summary the results. This could take ~20 minutes to run. The rows starting with 'beta_' are the posterior distributions of regression parameters:
```{r}
fit = regddm(
regddm_data$data1,
regddm_data$data2,
model
)
print(fit)
```
In this example, `iq` is negatively correlated with `v_memload`. The higher the influence of `memload` on drift rate, the lower the `iq` of the subject.
# Using your own data!
If you want to fit the model on your own data, you need to specify `data1`, `data2` and `model`.
`data1` is subject-level data table. It should contain the following:
* `id`: unique indexing column for each subject.
* other subject-level variables that we want to include in the regression. Missing values are supported
`data2` is trial-level data table. It should contain the following:
* `id`: the subject of each trial using the same index in `data1`.
* `rt`: response time of the trial in seconds.
* `response``: response the trial. must be either 0 or 1.
* trial-level variables. These are the variables that differ by trial, such as difficulty of the task or different numbers on the screen. We assume that subjects' behavior changes according to these variables. These variables cannot contain missing values.
`model` is the proposed dependency between these parameters. Default is an empty list. It must be a list of 0 - 5 formulas. The outcome of these formulas can be either:
* one of the four DDM parameters `a`, `t`, `z`, `v`, modeling the relationship between DDM parameters and trial-level variables.
* one formula for GLM regression, modeling the relationship between estimated DDM parameters and other subject-level variables.
`family` is the family of distribution of GLM. It can be either `"gaussian"`, `"bernoulli"` or `"poisson"`. Default is `"gaussian"`.
`init` is how we initialize the MCMC algorithm. The `"default"` initialization should work in most conditions
`prior` determines whether to use the default prior for DDM parameters or not. Default is `TRUE`
`stan_filename` is the file location for the automatically generated stan model. If an empty string '' is provided, a temporary file will be created and deleted after the model is fit. Default is `"stan_model.stan"`
`gen_model` determines whether to generate the model or not. Default is `TRUE`.
`fit_model` determines whether to fit the model or not. Default is `TRUE`.
`...`: additional parameters used by `rstan`, including `warmup`,`iter`,`chains`,`cores` etc.
# Citation
to be added
Owner
- Login: biorabbit
- Kind: user
- Repositories: 2
- Profile: https://github.com/biorabbit
GitHub Events
Total
- Watch event: 2
- Push event: 8
Last Year
- Watch event: 2
- Push event: 8
Packages
- Total packages: 1
-
Total downloads:
- cran 106 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 2
- Total maintainers: 1
cran.r-project.org: RegDDM
Generalized Linear Regression with DDM
- Homepage: https://github.com/biorabbit/RegDDM
- Documentation: http://cran.r-project.org/web/packages/RegDDM/RegDDM.pdf
- License: GPL (≥ 3)
-
Latest release: 1.1
published 12 months ago
Rankings
Dependent packages count: 27.6%
Dependent repos count: 34.0%
Average: 49.5%
Downloads: 86.9%
Maintainers (1)
Last synced:
10 months ago
Dependencies
DESCRIPTION
cran
- dplyr * imports
- easyRT >= 0.1.0 imports
- purrr * imports
- rstan >= 2.32.3 imports
- stringr * imports