WINBUGS "эта цепочка содержит неинициализированные переменные"
Я дал все значения для случайных узлов, но WinBUGS по-прежнему дает мне сообщение о том, что цепочка содержит неинициализированные переменные. Когда я пытаюсь сгенерировать начальные единицы, конвергенция отсутствует из-за неинформативных используемых априорных значений. Какой узел мне здесь не хватает в начальных значениях? Спасибо за любую помощь!
## Normal likelihood, identity link
# Random effects model for multi-arm trials
model{ # *** PROGRAM STARTS
for(i in 1:ns){ # LOOP THROUGH STUDIES
w[i,1] <- 0 # adjustment for multi-arm trials is zero for control arm
delta[i,1] <- 0 # treatment effect is zero for control arm
mu[i] ~ dnorm(0,.0001) # vague priors for all trial baselines
for (k in 1:na[i]) { # LOOP THROUGH ARMS
var[i,k] <- pow(se[i,k],2) # calculate variances
prec[i,k] <- 1/var[i,k] # set precisions
y[i,k] ~ dnorm(theta[i,k],prec[i,k]) # normal likelihood
theta[i,k] <- (mu[i] + delta[i,k]) + (beta[t[i,k]]-beta[t[i,1]]) * (x[i]) +
(beta1[t[i,k]]-beta1[t[i,1]]) * (x1[i]) + (beta2[t[i,k]]-
beta2[t[i,1]]) * (x2[i]) + (beta3[t[i,k]]-beta3[t[i,1]]) * (x3[i]) # model for linear predictor, and covariate effect
dev[i,k] <- (y[i,k]-theta[i,k])*(y[i,k]-theta[i,k])*prec[i,k] #Deviance
contribution
}
resdev[i] <- sum(dev[i,1:na[i]]) # summed residual deviance contribution for this trial
for (k in 2:na[i]) { # LOOP THROUGH ARMS
delta[i,k] ~ dnorm(md[i,k],taud[i,k]) # trial-specific LOR distributions
md[i,k] <- d[t[i,k]] - d[t[i,1]] + sw[i,k] # mean of treat effects
distributions (with multi-arm trial correction)
taud[i,k] <- tau *2*(k-1)/k # precision of treat effects distributions (with multi-arm trial correction)
w[i,k] <- (delta[i,k] - d[t[i,k]] + d[t[i,1]]) # adjustment for multi-arm RCTs
sw[i,k] <- sum(w[i,1:k-1])/(k-1) # cumulative adjustment for multi-arm trials
}
}
totresdev <- sum(resdev[]) # Total Residual Deviance
d[1]<-0 # treatment effect is zero for reference treatment
beta[1] <- 0 # covariate effect is zero for reference treatment
beta1[1] <- 0 # covariate effect is zero for reference treatment
beta2[1] <- 0 # covariate effect is zero for reference treatment
beta3[1] <- 0 # covariate effect is zero for reference treatment
for (k in 2:nt){ # LOOP THROUGH TREATMENTS
d[k] ~ dnorm(0,.0001) # vague priors for treatment effects
beta[k] <- B # common covariate effect
beta1[k] <- B1 # common covariate effect
beta2[k] <- B2 # common covariate effect
beta3[k] <- B3 # common covariate effect
}
B ~ dnorm(0,.0001) # vague prior for covariate effect
B1 ~ dnorm(0,.0001) # vague prior for covariate effect
B2 ~ dnorm(0,.0001) # vague prior for covariate effect
B3 ~ dnorm(0,.0001) # vague prior for covariate effect
sd ~ dunif(0,5) # vague prior for between-trial SD.
tau <- pow(sd,-2) # between-trial precision = (1/between-trial variance)
##ranking of best treatment
# ranking on relative scale
for (k in 1:nt) {
rk[k] <- nt+1-rank(d[],k) # assumes events are ôgoodö
# rk[k] <- rank(d[],k) # assumes events are ôbadö
best[k] <- equals(rk[k],1) #calculate probability that treat k is best
for (h in 1:nt){ prob[h,k] <- equals(rk[k],h) } # calculates
вероятность того, что обработка k является h-ой лучшей} }
#Data
list(ns=36, nt=8)
t[,1] t[,2] t[,3] na[] y[,1] y[,2] y[,3] se[,1] se[,2]
se[,3] x[] x1[] x2[] x3[]
2 1 NA 2 3.07 0.01 NA 0.247 0.095 NA 1 0 0 0
3 1 NA 2 1.4 -0.1 NA 0.66 0.88 NA 1 0 0 0
3 7 NA 2 3.7 2.8 NA 0.226 0.341 NA 1 0 0 0
4 7 NA 2 2.6 3 NA 0.143 0.254 NA 1 0 0 0
5 7 NA 2 2.5 2.1 NA 0.563 0.539 NA 1 0 0 0
6 1 NA 2 2.8 -0.1 NA 0.201 0.347 NA 1 0 0 0
3 1 NA 2 2.1 1.1 NA 0.933 0.796 NA 0 1 0 0
4 7 NA 2 1.58 1.64 NA 0.246 0.242 NA 0 1 0 0
5 7 NA 2 1.3 0.9 NA 0.563 0.563 NA 0 1 0 0
5 7 NA 2 0.11 -0.16 NA 0.272 0.267 NA 0 1 0 0
3 7 3 3 1.58 0.58 2.87 0.167 0.165 0.166 0 0 1 0
3 8 NA 2 2.8 2.4 NA 0.292 0.299 NA 0 0 1 0
4 5 NA 2 2.44 1.98 NA 0.145 0.208 NA 0 0 1 0
6 1 NA 2 2.6 0.1 NA 0.107 0.187 NA 0 0 1 0
6 5 NA 2 2.7 2.4 NA 0.131 0.187 NA 0 0 1 0
3 5 NA 2 4.8 3.7 NA 0.482 0.482 NA 0 0 0 1
3 7 NA 2 1.75 1.32 NA 0.238 0.237 NA 0 0 0 1
5 7 NA 2 2.594 1.992 NA 0.373 0.373 NA 0 0 0 1
5 7 NA 2 1.9 1.3 NA 0.373 0.373 NA 0 0 0 1
5 7 NA 2 5.1 3.1 NA 0.373 0.373 NA 0 0 0 1
5 7 NA 2 5.27 3.48 NA 0.366 0.344 NA 0 0 0 1
5 7 NA 2 0.9 0.7 NA 0.417 0.417 NA 0 0 0 1
5 7 NA 2 2.2 1.2 NA 0.353 0.353 NA 0 0 0 1
5 7 NA 2 2.89 1.9 NA 0.264 0.264 NA 0 0 0 1
5 7 NA 2 1.2 0.6 NA 0.394 0.394 NA 0 0 0 1
5 7 NA 2 0.89 0.62 NA 0.412 0.423 NA 0 0 0 1
5 8 NA 2 1.7 1.9 NA 0.274 0.258 NA 0 0 0 1
8 7 NA 2 2.07 0.93 NA 0.46 0.46 NA 0 0 0 1
3 7 NA 2 3.37 3.29 NA 0.197 0.28 NA 0 0 0 1
3 7 NA 2 4 3.4 NA 0.224 0.218 NA 0 0 0 1
3 7 NA 2 3.227 2.271 NA 0.394 0.394 NA 0 0 0 1
5 7 NA 2 3.02 1.63 NA 0.207 0.213 NA 0 0 0 1
5 7 NA 2 4 4 NA 0.417 0.417 NA 0 0 0 1
5 7 NA 2 4.2 3.7 NA 0.207 0.213 NA 0 0 0 1
7 NA NA 1 4.58 NA NA 0.576 NA NA 0 0 0 1
8 7 NA 2 1.03 0.97 NA 0.347 0.316 NA 0 0 0 1
END
# Initial values
list(d=c(NA,0,0,0,0,0,0,0), mu=c(0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), B=0, B1=0,
B2=0, B3=0, sd=1, delta=structure(.Data=c(NA,-1,NA,NA,-1,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,-1,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA), .Dim=c(36, 3)))
Есть ли начальное значение, которое мне не хватает? К сожалению, генерировать начальные единицы в этом случае не вариант.