rev_e {binaryRL}R Documentation

Step 4: Reviewing experimental effect

Description

This function takes the optimal parameters generated by 'fit_p' and applies them back to each subject's data to generate a new column, 'Rob_Choose'. This allows users to analyze whether the reinforcement learning model can reproduce the original experimental effects observed in the data.

Usage

rev_e(data, result, model, model_name, param_prefix, n_trials)

Arguments

data

[data.frame] This data should include the following mandatory columns:

  • "sub"

  • "time_line" (e.g., "Block", "Trial")

  • "L_choice"

  • "R_choice"

  • "L_reward"

  • "R_reward"

  • "sub_choose"

result

[data.frame] Output data generated by the 'fit_p()' function. Each row represents model fit results for a subject.

model

[function] A model function to be applied in evaluating the experimental effect.

model_name

[character] A character string specifying the name of the model to extract from the result.

param_prefix

[character] A prefix string used to identify parameter columns in the 'result' data (e.g., "param_").

n_trials

[integer] Number of total trials in the experimental task.

Value

A list, where each element is a data.frame representing one subject's results. Each data.frame includes the value update history for each option, the learning rate (eta), discount rate (gamma), and other relevant information used in each update.


[Package binaryRL version 0.8.3 Index]