-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpeer_ocu.py
More file actions
64 lines (50 loc) · 2.75 KB
/
peer_ocu.py
File metadata and controls
64 lines (50 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from mbmvpa.utils.computational_modeling_utils import *
class ComputationalModel(Base):
def _set_latent_process(self, df_events, param_dict):
# get individual parameter values.
rho = param_dict["rho"]
tau = param_dict["tau"]
ocu = param_dict["ocu"]
for condition,\
p_gamble,\
safe_Hpayoff,\
safe_Lpayoff,\
risky_Hpayoff,\
risky_Lpayoff,\
choice in get_named_iterater(df_events,['condition',
'p_gamble',
'safe_Hpayoff',
'safe_Lpayoff',
'risky_Hpayoff',
'risky_Lpayoff',
'choice']):
U_safe = p_gamble * pow(safe_Hpayoff, rho) + \
(1-p_gamble) * pow(safe_Lpayoff, rho)
U_risky = p_gamble * pow(risky_Hpayoff, rho) + \
(1-p_gamble) * pow(risky_Lpayoff, rho)
self._add('Util_solo_safe',U_safe)
self._add('Util_solo_risky',U_risky)
if condition == 1: # safe-safe
U_safe += ocu
elif condition == 3: # risky-risky
U_risky += ocu
pRisky = inv_logit(tau * (U_risky - U_safe))
##########################needs additional consideration for fMRI#######################
if choice == 0: # modified utility: U_OCU chosen gamble − U_OCU unchosen gamble, for fMRI extraction
self._add('Util_unchosen_ocu',U_safe) # vmPFC
self._add('Util_unchosen_ocu',U_risky)
elif choice == 1:
self._add('Util_chosen_ocu',U_safe) # vmPFC
self._add('Util_chosen_ocu',U_risky)
# U_ocu_safe and U_ocu_risky should be merged into U_ocu
if condition == 1: # safe-safe
self._add('distance',pRisky) # dACC, insula via interactive effect
elif condition == 3: # risky-risky
self._add('distance',1-pRisky) # dACC, insula via interactive effect
# two distance_ss and distance_rr are essentially the same parameter
#########################################################################################
#self._add('Util_ocu_safe',U_safe)
#self._add('Util_ocu_risky',U_risky)
self._add('Prisky',pRisky)
self._add('Psafe', 1-pRisky)
latent_process_onset = {}