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.
rpl_e(
data,
id = NULL,
result,
model,
model_name,
param_prefix,
n_trials = NULL
)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.
[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"
[vector] Participant IDs for subjects who need to replay the experiment.
[data.frame] Output data generated by the `fit_p()` function. Each row represents model fit results for a subject.
[function] A model function to be applied in evaluating the experimental effect.
[character] A character string specifying the name of the model to extract from the result.
[character] A prefix string used to identify parameter columns in the `result` data (e.g., "param_").
[integer] Number of total trials in the experimental task.