From: "Joon Jin Song" <[log in to unmask]>
Subject: Problem with spatial-temporal model
Hello all,
In running the Bayesian Hierarchical spatial-temporal model in Winbugs 13, I got
this message: "can not sample from left censored node alpha.tau[6]". Alpha is a
random effect and a vector 25 by 1. Does anyone know about this message?
Thank you in advance.
Jin.
# TEXAS COUNTY LEVEL MODEL - 1992-1999 DATA
# KAB CRASHES FOR RURAL 2-LN LOW-VOLUME ROADS
# N: NUMBER OF COUNTIES, M: NUMBER OF DISTRICTS
# DISTRICT[i]: DISTRICT NUMBER FOR COUNTY i
# SPATIAL EFFECTS: CAR.NORMAL MODEL WITH 1/[(1+a0*DISTANCE)**a1] AS WEIGHTS
(a0=a1=1 in this run)
# Three counties have zero VMTs (57 Dallas, 66 Kenedy, and 102 Harris) and
should be removed
# "deviance" is automatically computed by WinBugs
# PURE RANDOM VARIATION INDEPENDENT OF OTHER COMPONENTS: e[i] ~ N(0,
e.var=1/e.tau)
model
{
for(t in 1:time) {
for(i in 1 : N) {
Y[t,i] ~ dpois(mu[t,i])
log(mu[t,i]) <- log(VMT[t,i]) + alpha[DISTRICT[i]] + beta[1]*(WET[t,i] -
mean(WET[t,]))
+ beta[2]*(CURVE[t,i] - mean(CURVE[t,])) + beta[3]*(RDSIDE[t,i] -
mean(RDSIDE[t,]))
+ beta[4]*(CURVE[t,i] - mean(CURVE[t,]))*(WET[t,i] - mean(WET[t,]))
+ beta[5]*(WET[t,i] - mean(WET[t,]))*(RDSIDE[t,i] - mean(RDSIDE[t,]))
+ beta[6]*(CURVE[t,i] - mean(CURVE[t,]))*(RDSIDE[t,i] - mean(RDSIDE[t,]))+ETA[i]
+DELTA[t]+e[t,i]
theta[t,i]<-log(mu[t,i])
var[t,i] <- mu[t,i]
Yhat[t,i] <- mu[t,i]
rate.raw[t,i] <- Y[t,i]/(VMT[t,i])
rate.est[t,i] <- mu[t,i]/(VMT[t,i])
predY.err[t,i] <- Y[t,i] - Yhat[t,i]
predr.err[t,i] <- rate.est[t,i]-rate.raw[t,i]
}
}
rateraw.avg <- mean(rate.raw[,])
rateest.avg <- mean(rate.est[,])
predYerr.avg <- mean(predY.err[,])
predrerr.avg <- mean(predr.err[,])
# Priors for fixed effects:
for (k in 1 : 6) { beta[k] ~ dnorm(0.0, 0.0001) }
# for (j in 1 : M) { alpha[j] ~ dflat() }
# alpha.mean <- mean(alpha[])
# Pure random effects
for ( t in 1:time) {
for (i in 1:N) {e[t,i] ~ dnorm(0.0, e.tau) } }
# Hyper-prior
# for (i in 1:N) {e.tau[i] ~ dgamma(1.0E-3,1.0E-3) }
e.tau ~ dgamma(1.0E-3, 1.0E-3)
e.var <- 1./e.tau
e.sd <- sqrt(e.var)
# Priors for random coefficients: random district effects
for (j in 1 : M) {
alpha[j] ~ dnorm(alpha.mu[j], alpha.tau[j])
alpha.sd[j] <- 1./sqrt(alpha.tau[j])
}
# Hyper-priors:
for (j in 1 : M) {
# alpha.mu[j] ~ dnorm(0., 0.0001)
alpha.mu[j] ~ dflat()
alpha.tau[j] ~ dgamma(1.0E-3,1.0E-3)
}
# PRIORS FOR SPATIAL EFFECTS
# GCD[i,j] = Great Circle Distance between two counties
# weight(i,j)=1./(GCD[i,j]+1)
ETA[1:N] ~ car.normal(adj[] , weights[], num[], tau);
# ETA.mean or SUM(ETA) is constrained to 0 in WinBugs
ETA.mean <- mean(ETA[])
# tau ~ dgamma(0.5, 0.0005)
tau ~ dgamma(0.1, 0.1)
sigma <- 1./sqrt(tau)
#for (k in 1 : 2) {gamma[k] ~ dnorm(0.0, 0.0001)}
# AR(1) prior
sigma.delta1<-sigma.delta/(1-rho*rho)
DELTA[1] ~ dnorm(0, sigma.delta1)
for (k in 2:time) {
delta.mean[k-1]<-rho*DELTA[k-1]
DELTA[k] ~ dnorm(delta.mean[k-1],sigma.delta)
}
rho ~ dunif(-1,1)
sigma.delta ~ dgamma(1.0E-3,1.0E-3)
}
--------------------------------------------------------------------------------
---
Joon Jin Song Office) 862-3446
Graduate Research Assistant, Fax) 845-3144
Center for Transportation Safety, Gilchrist 304
Texas Transportation Institute, http://jsong.wo.to
Texas A&M University, [log in to unmask]
College Station, TX 77840 [log in to unmask]
-------------------------------------------------------------------
To mail the BUGS list, mail to [log in to unmask]
You can search old messages at www.jiscmail.ac.uk/lists/bugs.html
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
This list is for discussion of modelling issues and the BUGS
software. For help with crashes and error messages, first mail
[log in to unmask]
|