regddm {RegDDM} | R Documentation |
Bayesian hierachical generalized linear regression using Drift-Diffusion Model
Description
regddm
makes it easy to fit a single Bayesian hierarchical drift-diffusion
model (DDM) that estimates the DDM parameters of each subject and uses the
estimated parameters as variables in a generalized linear regression.
Usage
regddm(
data1,
data2,
model = list(),
family = "gaussian",
init = "default",
prior = TRUE,
stan_filename = "",
gen_model = TRUE,
fit_model = TRUE,
warmup = 500,
iter = 1000,
chains = 4,
cores = 4,
...
)
Arguments
data1 |
Subject-level dataframe with column such as age and gender. It
must contain an |
data2 |
Trial-level dataframe. It must contain three columns: |
model |
A list containing 0-5 formulas, specifying the dependence structure between variables. |
family |
Family of distribution of |
init |
Either |
prior |
A losigtic value, specifying whether or not to use default prior
for DDM parameters. By default, |
stan_filename |
A string specifying the automatically generated |
gen_model |
A logistic value indicating weather or not to generate the
model. If not, RegDDM will not generate the code but use the existing |
fit_model |
A logistic value indicating weather or not to fit the model.
If not, RegDDM will only generate the code and return an unfitted
|
warmup |
Number of warm-up iterations. Default is 500. |
iter |
Number of iterations, which must be greater than |
chains |
Number of chains to run for diagnosis. Default value is 4. |
cores |
Number of cores to run the chains. It is best to make
|
... |
Other parameters sent to |
Value
A regddmfit
object.
References
To be added
Examples
# Note: each example takes about 20 minutes to run. During this period, you
# may not be able to open/save files or see the progress. To prevent this,
# it is recommended to copy, paste and run the example code in the console.
## Not run:
# Example analysis over the simulated tutorial dataset.
data(regddm_tutorial)
model = list(v ~ x1, y ~ v_0 + v_x1 + c1)
fit1 = regddm(
regddm_tutorial$data1,
regddm_tutorial$data2,
model,
stan_filename = ""
)
print(fit1)
# Alternatively, subjects' DDM parameters can be used as the outcome.
model = list(v ~ x1, v_x1 ~ y + c1)
fit2 = regddm(
regddm_tutorial$data1,
regddm_tutorial$data2,
model,
stan_filename = ""
)
print(fit2)
## End(Not run)