cpt_hierarchical_prelec-98.txt 2.84 KB
Newer Older
1
2
3
model
{

4
  # in the hierarchical model, agent level parameters are drawn from a group level distribution
5
6

  # group level
7
8
9
10
11

  ## we specify priors for the group level distributions on transformed scales to facilitate the hierarchical implementation (cf. Rouder & Lu, 2005; Nilsson, 2011)
  ## prob is probit scale, log is the logarithmic scale
  ## the priors on the prob and log scale translate to uninformative priors on the original line
  ## we use uninformative priors for CPT parameters to facilitate comparison of different generative mechanisms
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

  ## alpha

  mu.alpha.prob ~ dnorm(0, 1)
  tau.alpha.prob <- pow(sigma.alpha.prob, -2)
  sigma.alpha.prob ~ dunif(0, 10)

  ## gamma

  mu.gamma.prob ~ dnorm(0, 1)
  tau.gamma.prob <- pow(sigma.gamma.prob, -2)
  sigma.gamma.prob ~ dunif(0, 10)

  ## delta

  mu.delta.prob ~ dnorm(0, 1)
  tau.delta.prob <- pow(sigma.delta.prob, -2)
  sigma.delta.prob ~ dunif(0, 10)

  ## rho

  mu.rho.log ~ dunif(-2.3, 1.61)
  tau.rho.log <- pow(sigma.rho.log, -2)
  sigma.rho.log ~ dunif(0, 1.13)

37
  ## retransfrom group level means and extend scales to a reasonable range (cf. Scheibehenne & Pachur, 2015)
38

39
  mu.alpha <- phi(mu.alpha.prob)
40
  mu.gamma <- 2*phi(mu.gamma.prob)
41
  mu.delta <- 10*phi(mu.delta.prob)
42
43
  mu.rho <- exp(mu.rho.log)

44
  # agent level
45

46
  for (j in 1:n_agents)
47
48
  {

49
50
51
52
53
54
55
56
57
  ## transformed agent-level parameters are drawn from group-level normal distributions on the respective scale

	alpha.prob[j] ~ dnorm(mu.alpha.prob, tau.alpha.prob) T(-3, 3)
	gamma.prob[j] ~ dnorm(mu.gamma.prob, tau.gamma.prob) T(-3, 3)
	delta.prob[j] ~ dnorm(mu.delta.prob, tau.delta.prob) T(-3, 3)
	rho.log[j]   ~ dnorm(mu.rho.log, tau.rho.log)

	## retransform parameters and extend scales to a reasonable range

58
	alpha[j] <- phi(alpha.prob[j])
59
	gamma[j] <- 2*phi(gamma.prob[j])
60
	delta[j] <- 10*phi(delta.prob[j])
61
62
63
64
  rho[j]   <- exp(rho.log[j])

    # define CPT model

65
    for (i in 1:n_gambles)
66
67
68
69
	  {

    # value function

70
71
72
73
	  v.a.o1[i, j] <- pow(a_o1[i], alpha[j])
	  v.a.o2[i, j] <- pow(a_o2[i], alpha[j])
	  v.b.o1[i, j] <- pow(b_o1[i], alpha[j])
  	v.b.o2[i, j] <- pow(b_o2[i], alpha[j])
74
75
76

	  # weighting function (cf. Prelec, 1998)

77
78
	  w.a.p2[i, j] <- exp(-delta[j]*(pow((-1*(log(a_p2_exp[i, j]))), gamma[j])))
	  w.a.p1[i, j] <- 1-w.a.p2[i, j]
79
80
	  w.b.p1[i, j] <- exp(-delta[j]*(pow((-1*(log(b_p1[i]))), gamma[j])))
	  w.b.p2[i, j] <- 1-w.b.p1[i, j]
81

82
83
	  Vf.a[i, j]  <- w.a.p1[i, j] * v.a.o1[i, j] + w.a.p2[i, j] * v.a.o2[i, j]
	  Vf.b[i, j]  <- w.b.p1[i, j] * v.b.o1[i, j] + w.b.p2[i, j] * v.b.o2[i, j]
84
85
86

	  # rescale subjective values to alleviate possible parameter intercorrelations (cf. Krefeld-Schwalb et al., 2021)

87
88
	  Vf.a.re[i, j] <- pow(Vf.a[i, j], (1/alpha[j]))
	  Vf.b.re[i, j] <- pow(Vf.b[i, j], (1/alpha[j]))
89
90
91

	  # stochastic choice rule

92
93
	  binval[i, j] <- (1)/(1+exp((-1*rho[j])*(Vf.a.re[i, j]-Vf.b.re[i, j])))
	  choice[i, j] ~ dbern(binval[i, j])
94
95
96
97
98
	  }
  }
}