eml_twochoiceRL: Expectation-Maximization with Laplace approximation (EML) of...

Description Usage Arguments Value

View source: R/estimate_twochoiceRL.R

Description

This function runs the EML technique to recover behavior in a two-choice decision task.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
eml_twochoiceRL(
  data = NULL,
  param = list(init_x1, init_x2),
  prior_mean = c(m1, m2),
  prior_sd = c(s1, s2),
  fn = "eml.objectiveFunction",
  opt = "TRM",
  radius = c(tr_rad[1], tr_rad[2]),
  nRes = nRes,
  iter = iter,
  eml_data = eml_data,
  progress_bar = progress_bar
)

Arguments

data

simulated two-choice task data

param

randomly generated initial parameters.

prior_mean

mean priors for x1 and x2, respectively. Defaults to mean 0 for both parameters.

prior_sd

standard deviation priors for x1 and x2, respectively. Defaults to 5 for both parameters.

fn

objective function being minimized

opt

optimization algorithm used. Defaults to trust-region method (trm)

radius

starting and maximum allowed trust region radius. Defaults to 1 and 5.

nRes

number of restarts. Defaults to 5.

iter

iteration of algorithm

eml_data

data to be passed for succeeding iterations

progress_bar

track completion time of estimation. Defaults to TRUE.

Value

A list containing the sum log-likelihood, eml estimates of parameter 1 per subject, eml estimates of parameter 2 per subject, laplace values of parameter 1 per subject, laplace values of parameter 2 per subject.


psuthaharan/twochoiceRL documentation built on Dec. 22, 2021, 9:56 a.m.