m**c 发帖数: 88 | 1 model{
for (i in 1:n){
y[i,1:2]~ dmnorm( mu[], T[,] )
}
for (i in 1:P){
mu[i] <- inprod(A[i,],x[,])+ A0[i,1]
}
x[1,1] ~ dnorm(0.0, 1.0E-4)
x[2,1] ~ dnorm(0.0, 1.0E-4)
#x[1,1] ~ dunif(3,7)
#x[2,1] ~ dunif(4,8)
T[1:P,1:P] <- inverse(V[,])
}
INITS
list(x = structure(.Data = c(3,6), .Dim =c(2,1)))
DATA (RECT.)
list( n=10, P=2,
A = structure(.Data = c(1.5,1.2, 2, 0.7),.Dim =c(2,2)),
A0 = structure(.Data = c(0.7,0.8),.Dim =c(2,1)),
V = structure(.Data = c(0.25,0,0,1),.Dim =c(2,2)) )
y[,1] y[,2]
12.7322583711556 12.9002919491858
12.0192425225677 12.6475926319601
12.6090783907703 11.3604652340585
12.6812334055904 10.4036955063776
11.6360116159087 11.1230766692850
12.2047338897579 11.1269676727326
11.8372861052357 12.5882280896650
11.9029081398666 12.4102188492234
13.0935333381790 12.2977732136862
12.7465543800294 11.9218429434102
END
为什么我用均匀分布dunif(a,b)作为x[]的先验分布,不管我怎么设施a,b值,采样是
总是报错,无法采样,而换成正太分布dnorm(mean,tau)后,不管怎样设置mean,
tau值,都不会出现这个问题,均匀分布这么不好用啊?什么问题啊?
这个错误是这样的:编译都能通过,最后update时,WinBUGS 报错:
Trap: undefined real result | m**c 发帖数: 88 | 2 出现这个报错的可能的其他原因,但是还是不清楚为什么用均匀分布就报错?
a) 'undefined real result' indicates numerical overflow. Possible reasons
include:
- initial values generated from a 'vague' prior distribution may be
numerically extreme - specify appropriate initial values;
- numerically impossible values such as log of a non-positive number - check
, for example, that no zero expectations have been given when Poisson
modelling;
- numerical difficulties in sampling. Possible solutions include:
- better initial values;
- more informative priors - uniform priors might still be used but with
their range restricted to plausible values;
- better parameterisation to improve orthogonality;
- standardisation of covariates to have mean 0 and standard deviation 1.
- can happen if all initial values are equal. |
|