if (FALSE) {
func_eta <- function(
# Trial number
i,
# Number of times this option has appeared
L_freq,
R_freq,
# Number of times this option has been chosen
L_pick,
R_pick,
# Current value of this option
L_value,
R_value,
# Extra variables
var1 = NA,
var2 = NA,
# Expected value for this stimulus
value,
# Subjective utility
utility,
# Reward observed after choice
reward,
# Occurrence count for this stimulus
occurrence,
# Free Parameter
eta,
# Extra parameters
alpha,
beta
){
################################# [ TD ] ####################################
if (length(eta) == 1) {
eta <- as.numeric(eta)
}
################################ [ RSTD ] ###################################
else if (length(eta) > 1 & utility < value) {
eta <- eta[1]
}
else if (length(eta) > 1 & utility >= value) {
eta <- eta[2]
}
################################ [ ERROR ] ##################################
else {
eta <- "ERROR" # Error check
}
return(eta)
}
}
Run the code above in your browser using DataLab