if (FALSE) {
func_gamma <- 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
gamma = 1,
# Extra parameters
alpha,
beta
){
############################## [ Utility ] ##################################
if (length(gamma) == 1) {
gamma <- as.numeric(gamma)
utility <- sign(reward) * (abs(reward) ^ gamma)
}
############################### [ Error ] ###################################
else {
utility <- "ERROR"
}
return(list(gamma, utility))
}
}
Run the code above in your browser using DataLab