Description Usage Arguments Value Examples
View source: R/estimate_twochoiceRL.R
This function performs parameter estimation to recover behavior in a two-choice decision task
1 2 3 4 5 6 7 8 9 10 11 |
seed_value |
user-specified random value that ensures replication of results. Defaults to 528. |
data |
simulated two-choice task data |
method |
parameter estimation technique used; either maximum-likelihood estimation (mle), maximum a posteriori (map) or expectation-maximization with laplace approximation (eml). Defaults to mle. |
nRes |
number of restarts. Defaults to 5. |
tr_rad |
starting and maximum allowed trust region radius. Defaults to 1 and 5. |
prior_mean |
initial prior means of parameters (x1,x2). Set value if method = "map" or "eml". |
prior_sd |
initial prior standard deviations of parameters (x1,x2). Set value if method = "map" or "eml". |
plot |
visualize estimation performance between true parameters vs estimated parameters. Defaults to FALSE. |
progress_bar |
track completion time of estimation procedure. Defaults to TRUE. |
A list containing a dataframe of the true and estimated parameter values, the measures of the bias, rmse and pearson correlation of parameters x1 and x2, the posterior hyperparameters (if method = "eml") per iteration, plot (if plot = TRUE) of the relationship between the true and estimated parameter values, and a plot (if method = eml and plot = TRUE) of the posterior hyperparameters per iteration.
1 2 3 4 5 6 7 8 9 10 11 | # Save simulated task data to a variable, say, data_sim
data_sim <- simulate_twochoiceRL(trials_unique = TRUE)
# Recover behavioral parameters using maximum-likelihood estimation (MLE)
est_mle <- estimate_twochoiceRL(data = data_sim, method = "mle", plot=FALSE)
# View the true and MLE-estimated parameter values
View(est_mle[[1]]$value)
# If plot=TRUE, view correlation plot between the true and MLE-estimated parameter for x1
View(est_mle[[2]])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.