-
Notifications
You must be signed in to change notification settings - Fork 0
/
GES_chap11.txt
65 lines (57 loc) · 1.47 KB
/
GES_chap11.txt
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
model {
# Randomised Control Trials:
for (i in 1:R) {
# Likelihood
rct.rd[i] ~ dnorm(rct.psi[i], rct.prec[i])
# Random effects model
rct.psi[i] <- theta[1] + (rct.z[i] * sd.theta[1])
# Prior
rct.z[i] ~ dnorm(0, 0.001)
# Transformation
rct.prec[i] <- 1 / (rct.serd[i] * rct.serd[i])
}
# Comparative cohort studies:
for (i in 1:C) {
# Likelihood
coh.rd[i] ~ dnorm(coh.psi[i], coh.prec[i])
# Random effect model
coh.psi[i] <- theta[2] + (coh.z[i] * sd.theta[2])
# Prior
coh.z[i] ~ dnorm(0, 0.001)
# Transformation
coh.prec[i] <- 1 / (coh.serd[i] * coh.serd[i])
}
# Before and after studies:
for (i in 1:B) {
# Likelihood
ba.rd[i] ~ dnorm(ba.psi[i], ba.prec[i])
# Random effects model
ba.psi[i] <- theta[3] + (ba.z[i] * sd.theta[3])
# Prior
ba.z[i] ~ dnorm(0, 0.001)
# Transformation
ba.prec[i] <- 1 / (ba.serd[i] * ba.serd[i])
}
# Combining all 3 sources of information:
for (i in 1:T) {
# Regression effect model
theta[i] <- mean + (u[i] * sd.mean)
u[i] ~ dnorm(0, 1 / u.prec[i]^2)
# Prior
u.prec[i] ~ dunif(0, 1)
# Prior
sd.theta[i] ~ dnorm(0, 0.001)T(0, )
# Transformation
var.theta[i] <- sd.theta[i] * sd.theta[i]
# Transformation
prec.theta[i] <- 1 / (sd.theta[i] * sd.theta[i])
}
# Hyperpriors:
mean ~ dnorm(0, mean.prec)
sd.mean ~ dnorm(0, 1 / sd.prec^2)T(0, )
var.mean <- sd.mean * sd.mean
prec.mean <- 1 / (sd.mean * sd.mean)
sd.prec ~ dunif(0, 1)
mean.prec ~ dunif(0, 1)
mean.Pr <- exp(mean)
}