# [Winbugs] great divergence between prior and posterior distribution in Winbugs

#### yqxia

##### New Member
Hi, I am new starter of Winbugs. I am trying to simulate exporting coefficients of land uses based on the measurements of water nutrients. The prior distribution (e0, e1,e2,e3,e4, and k) was set according to the references. the winbug code is as followed:

model
{
for (i in 1:S)
{
for (j in 1:W)
{
LL[i,j]~dnorm(mu[i,j], tau)
e0[i,j]~dnorm(e0.mu,e0.tau)
e1[i,j]~dnorm(e1.mu, e1.tau)
e2[i,j]~dnorm(e2.mu, e2.tau)
e3[i,j]~dnorm(e3.mu, e3.tau)
e4[i,j]~dnorm(e4.mu, e4.tau)
k[i,j]~dnorm(k.mu, k.tau)I(0,2)
}
}
# Choice of prior of random effects variances for reginal physiographic province
# Prior 1: Coast Plain (CP)
e0.mu~dnorm(0.34,7.69)
e1.mu~dnorm(0.56, 0.657)
e2.mu~dnorm(10.12, 0.465)
e3.mu~dnorm(0.02, 6.25)
e4.mu~dnorm(0.02,7.69)

e0.tau~dgamma(0.01,0.001)
e1.tau~dgamma(0.01,0.001)
e2.tau~dgamma(0.01,0.001)
e3.tau~dgamma(0.01,0.001)
e4.tau~dgamma(0.01,0.001)
k.mu~dnorm(0.5288, 19.8958)
k.tau~dgamma(0.01, 0.001)
tau~dgamma(0.01,0.01)
sigma<-1/sqrt(tau)
}

After i run the model for 10000 times, I can get the posterior distribution of each coefficient. However, all the posterior distribution greatly differed from the prior distribution, even the range of data. I know there should be some differences, but generally the range should be same. I am really appreciated for any suggestions and comments.

the inital data and input data are listed below:

INitData:
list(e0.tau = 0.34, e1.tau = 0.56, e2.tau = 10.12, e3.tau = 0.02, e4.tau = 0.02, k.tau=0.5288, tau =1)

Data:
list(S=1,W=68,
Q=structure(.Data=c(1679899.604,1140238.739,831143.8458,8408671.292,2799467.65,532017.5129,311427.4486,286463.204,499845.723,4431571.709,1352308.362,326476.7203,142180.1912,46101.46181,38311.57977,39099.346,18679.0187,102679.4153,100267.6604,78520.3203,35854.59685,4235.268648,1124.148612,1432.1626,6395.828609,22671.61925,49713.16967,49031.1077,38851.5676,62106.69949,146182.7689,151950.2647,216544.791,301893.5753,397369.4298,433260.784,507403.4991,785593.4744,582305.7251,1045098.195,2362058.204,2287228.068,671051.8377,694559.9749,1262452.995,687710.2186,1591227.233,1946579.929,6775923.725,3141655.847,937361.6256,1121568.543,561172.1346,667396.9998,342911.6248,186053.1583,166825.2309,122953.7924,103461.6847,45606.33054,22854.27754,7028.01481,2940.091499,65416.43176,6563.628011,1880.346074,39.63312539,6.211159109), .Dim=c(1,68)),
LL=structure(.Data=c(157910.5628,129987.2162,202799.0984,1202439.995,613083.4154,129280.2556,77856.86216,46979.96546,114464.6706,833135.4812,239358.58,59418.7631,20473.94753,599.3190036,0,508.291498,0,3696.458951,501.338302,0,0,0,0,0,0,0,546.8448664,0,0,558.9602954,146.1827689,607.8010587,649.6343729,905.6807258,794.7388596,18196.95293,4566.631492,366086.5591,127524.9538,251868.665,963719.7474,379679.8593,87907.79074,54175.67805,369898.7275,85276.06711,297559.4926,420461.2647,1748188.321,741430.7799,102172.4172,54956.85863,16273.9919,14682.734,2057.469749,5581.594749,9509.038163,6885.412375,4345.390757,45.60633054,0,0,0,719.5807494,0,0,0,0), .Dim=c(1,68)),
t0=structure(.Data=c(0.561147292,0.826731352,0.825358193,0.081581425,0.245043511,1.28941504,1.757443412,1.910598325,1.094970093,0.123503839,0.404727304,1.209585543,2.777472148,8.565921892,10.30762823,9.500551247,19.88676956,3.617719669,3.70473729,4.730817946,11.39338725,96.45322192,363.3908385,285.236681,60.72419134,17.13073583,7.812447341,7.921124741,13.5470244,8.474498543,3.600445787,3.463785571,2.43055089,3.302790585,2.509229909,2.301365124,1.965085499,1.829480331,2.468167059,1.375208393,0.60846418,0.73296968,2.498270225,2.413713554,1.327945541,2.475580275,1.069917493,0.874601565,0.251254577,0.541905904,1.00566429,0.840493539,1.679825237,1.412459322,2.00049031,3.687071957,4.112036163,5.579261681,5.290036785,12.00088039,23.94808223,77.87634668,186.1561512,6.036732827,60.16512824,210.0153405,9963.925811,59806.12215), .Dim=c(1,68)),
P=structure(.Data=c(70539.75634,70539.75634,150466.4078,150466.4078,150466.4078,150466.4078,133901.2987,133901.2987,133901.2987,133901.2987,133901.2987,69711.50088,69711.50088,69711.50088,69711.50088,131140.4472,131140.4472,131140.4472,131140.4472,131140.4472,75233.20392,75233.20392,75233.20392,75233.20392,141079.5127,141079.5127,141079.5127,141079.5127,70539.75634,70539.75634,70539.75634,70539.75634,70539.75634,70539.75634,70539.75634,70539.75634,70539.75634,137766.4908,137766.4908,137766.4908,137766.4908,137766.4908,137766.4908,137766.4908,137766.4908,206649.7363,206649.7363,206649.7363,206649.7363,206649.7363,68883.24542,68883.24542,68883.24542,68883.24542,62809.37208,62809.37208,62809.37208,62809.37208,69711.50088,69711.50088,69711.50088,69711.50088,69711.50088,66950.64936,66950.64936,66950.64936,66950.64936,66950.64936), .Dim=c(1,68)),
t1=structure(.Data=c(0.866639653,1.276809461,1.252839808,0.123835272,0.371960039,1.95724778,2.635565955,2.86524611,1.642081833,0.185213652,0.606952973,1.805176788,4.145079511,12.78372039,15.38303043,14.19962121,29.72296948,5.407080875,5.537138302,7.070728961,16.87872951,142.8905915,538.345229,422.5637801,89.39945574,25.22023638,11.50165239,11.66164958,20.50422317,12.82665508,5.449487779,5.242644455,3.678782616,5.108799683,3.881309647,3.55978168,3.039619956,2.772409383,3.74028045,2.084001991,0.922071571,1.082762133,3.690510631,3.565601288,1.961676158,3.71092251,1.603818284,1.311037524,0.376633421,0.812323009,1.553154695,1.298063875,2.594333395,2.181411678,3.036613578,5.596734318,6.241802216,8.468954683,7.933251653,17.99722914,35.91395876,116.7879697,279.1707609,9.009176768,89.79000581,313.4253877,14870.09141,89386.84278), .Dim=c(1,68)),
Ac=c(782.147065),
Acu=c(215.3012049),